-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fixup Signed-off-by: Matteo Collina <[email protected]> * fixup Signed-off-by: Matteo Collina <[email protected]> --------- Signed-off-by: Matteo Collina <[email protected]>
- Loading branch information
Showing
1 changed file
with
3 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,16 +11,6 @@ const defaultConnectionString = 'postgres://postgres:[email protected]:5432/pos | |
// We extend ServiceGenerator instead of DBGenerator because we | ||
// do not want to allow users to have their own migrations. | ||
class PlatformaticPgHooksGenerator extends ServiceGenerator { | ||
getDefaultConfig () { | ||
const defaultBaseConfig = super.getDefaultConfig() | ||
const defaultConfig = { | ||
db: { | ||
connectionString: null | ||
} | ||
} | ||
return Object.assign({}, defaultBaseConfig, defaultConfig) | ||
} | ||
|
||
getConfigFieldsDefinitions () { | ||
const serviceConfigFieldsDefs = super.getConfigFieldsDefinitions() | ||
return [ | ||
|
@@ -38,11 +28,12 @@ class PlatformaticPgHooksGenerator extends ServiceGenerator { | |
async _getConfigFileContents () { | ||
const baseConfig = await super._getConfigFileContents() | ||
const packageJson = await this.getStackablePackageJson() | ||
const dbUrlEnvVar = this.getEnvVarName('DB_URL') | ||
const config = { | ||
$schema: './stackable.schema.json', | ||
module: packageJson.name, | ||
db: { | ||
connectionString: '{DATABASE_URL}' | ||
connectionString: `{${dbUrlEnvVar}}` | ||
}, | ||
service: undefined | ||
} | ||
|
@@ -61,7 +52,7 @@ class PlatformaticPgHooksGenerator extends ServiceGenerator { | |
} | ||
|
||
this.addEnvVars({ | ||
DATABASE_URL: this.config.connectionString || defaultConnectionString | ||
DB_URL: this.config.connectionString || defaultConnectionString | ||
}, { overwrite: false }) | ||
|
||
const packageJson = await this.getStackablePackageJson() | ||
|