change db env variables to be in line wiht heroku

This commit is contained in:
Michael Schramm 2021-05-02 14:01:35 +02:00
parent 0e0989459d
commit a74f3888d1
2 changed files with 10 additions and 9 deletions

View File

@ -21,8 +21,9 @@
| Name | Default Value | Description |
| ---- | ------------- | ----------- |
| DB_URI | `sqlite://data.sqlite` | url in the format `TYPE://USER:PASS@HOST:PORT/NAME?EXTRA` ([read more](https://typeorm.io/#/connection-options/common-connection-options)) |
| DB_TABLE_PREFIX | *empty* | prefix all tables if used within same database as other applications. |
| DB_LOGGING | `false` | if `true` all db interactions will be logged to stdout |
| DB_MIGRATE | `true` | can be used in load balanced environments to only allow one container to perform migrations / manually execute migrations
| DATABASE_DRIVER | `sqlite` | database driver, either `sqlite` or `postgres` |
| DATABASE_URL | `sqlite://data.sqlite` | url in the format `TYPE://USER:PASS@HOST:PORT/NAME?EXTRA` ([read more](https://typeorm.io/#/connection-options/common-connection-options)) |
| DATABASE_TABLE_PREFIX | *empty* | prefix all tables if used within same database as other applications. |
| DATABASE_LOGGING | `false` | if `true` all db interactions will be logged to stdout |
| DATABASE_MIGRATE | `true` | can be used in load balanced environments to only allow one container to perform migrations / manually execute migrations

View File

@ -108,15 +108,15 @@ export const imports = [
useFactory: (configService: ConfigService): TypeOrmModuleOptions => ({
name: 'ohmyform',
synchronize: false,
type: configService.get<string>('DB_TYPE', 'sqlite') as any,
url: configService.get<string>('DB_URI', 'sqlite://data.sqlite'),
entityPrefix: configService.get<string>('DB_TABLE_PREFIX', ''),
logging: configService.get<string>('DB_LOGGING', 'false') === 'true',
type: configService.get<string>('DATABASE_DRIVER', 'sqlite') as any,
url: configService.get<string>('DATABASE_URL', 'sqlite://data.sqlite'),
entityPrefix: configService.get<string>('DATABASE_TABLE_PREFIX', ''),
logging: configService.get<string>('DATABASE_LOGGING', 'false') === 'true',
entities,
migrations: [
`${__dirname}/**/migrations/**/*{.ts,.js}`,
],
migrationsRun: configService.get<boolean>('DB_MIGRATE', true),
migrationsRun: configService.get<boolean>('DATABASE_MIGRATE', true),
}),
}),
TypeOrmModule.forFeature(entities),