Skip to content

Commit

Permalink
feat: implementing Postgres DB support
Browse files Browse the repository at this point in the history
  • Loading branch information
artursudnik committed Dec 20, 2022
1 parent e161ff2 commit 7ac9a68
Show file tree
Hide file tree
Showing 3 changed files with 193 additions and 5 deletions.
3 changes: 2 additions & 1 deletion apps/vc-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@
"@sphereon/pex": "~1.1.0",
"@nestjs/axios": "^0.1.0",
"@nestjs/serve-static": "^3.0.0",
"joi": "^17.0.0"
"joi": "^17.0.0",
"pg": "^8.0.0"
},
"devDependencies": {
"@nestjs/cli": "^9.0.0",
Expand Down
13 changes: 12 additions & 1 deletion apps/vc-api/src/config/db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,18 @@ export const typeOrmConfigFactory = (config: ConfigService): TypeOrmModuleOption
}

if (config.get<DB_TYPES>('DB_TYPE') === DB_TYPES.POSTGRES) {
throw new Error(`${DB_TYPES.POSTGRES} database not implemented`);
return {
type: 'postgres',
host: config.get('POSTGRES_DB_HOST'),
port: +config.get('POSTGRES_DB_PORT'),
username: config.get('POSTGRES_DB_USER'),
password: config.get('POSTGRES_DB_PASSWORD'),
database: config.get('POSTGRES_DB_NAME'),
dropSchema: config.get('DB_DROP_SCHEMA'),
synchronize: config.get('DB_SYNCHRONIZE'),
migrationsRun: config.get('DB_RUN_MIGRATIONS'),
...commonOptions
};
}
};

Expand Down
182 changes: 179 additions & 3 deletions common/config/rush/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 7ac9a68

Please sign in to comment.