refactor!: to biolerplate v2 (MAPCO 6292) - #53
Conversation
| POSTGRES_PASSWORD: postgres | ||
| POSTGRES_USER: postgres | ||
| POSTGRES_DB: postgres |
There was a problem hiding this comment.
Note:
You can add top-level ENVs and reference them.
See example here
There was a problem hiding this comment.
remove the env
you added a top-level env
| ...connectionOptions, | ||
| password: undefined, | ||
| ssl: { | ||
| key: readFileSync(ssl.key), |
There was a problem hiding this comment.
If readFilesSync fails, it throws an error. make sure it throws an indicative one
| const dbConfig = config.get<DbConfig>('db'); | ||
| const connectionOptions = createConnectionOptions({ entities: ENTITIES_DIRS, ...dbConfig }); | ||
| const config = container.resolve<ConfigType>(SERVICES.CONFIG); | ||
| const dbConfig: DbConfig = config.get('db'); |
There was a problem hiding this comment.
No need to assign DbConfig type. The type will auto resolve
| import { readPackageJsonSync } from '@map-colonies/read-pkg'; | ||
|
|
||
| export const SERVICE_NAME = readPackageJsonSync().name ?? 'unknown_service'; | ||
| export const DEFAULT_SERVER_PORT = 80; |
There was a problem hiding this comment.
please default to port 8080
| useFactory: (container): HealthCheck => { | ||
| const connection = container.resolve<Connection>(Connection); | ||
| return getDbHealthCheckFunction(connection); |
There was a problem hiding this comment.
create a function somewhere else. Don't create logic at containerConfig
| console.error('😢 - failed initializing the server'); | ||
| console.error(error); |
There was a problem hiding this comment.
why not using logger if its available? revert relevant changes
| // The typeorm CLI cannot await the async application config, so the db section is read directly | ||
| // from the local config file, honoring the same DB_* env overrides the schema defines for the application. |
|
Also, missing some files |
| DB_NAME: postgres | ||
| DB_USERNAME: postgres | ||
| DB_PASSWORD: postgres | ||
| # DB_SCHEMA: public |
| POSTGRES_PASSWORD: postgres | ||
| POSTGRES_USER: postgres | ||
| POSTGRES_DB: postgres |
There was a problem hiding this comment.
remove the env
you added a top-level env
|
|
||
| export const SERVICE_NAME = readPackageJsonSync().name ?? 'unknown_service'; | ||
| export const DEFAULT_SERVER_PORT = 80; | ||
| export const DB_HEALTHCHECK_TIMEOUT_MS = 5000; |
There was a problem hiding this comment.
remove it if you added it to the config
Related issues: MAPCO-6292
Closes #XXX ...
Further information: