File tree Expand file tree Collapse file tree 2 files changed +20
-20
lines changed
Expand file tree Collapse file tree 2 files changed +20
-20
lines changed Original file line number Diff line number Diff line change @@ -17,10 +17,7 @@ import {
1717import { IndexerConfig } from './interfaces/chain-indexer';
1818import { TypeOrmModuleOptions } from '@nestjs/typeorm';
1919import { web2JsonDefaultParams } from './defaults/web2-json-config';
20- import {
21- database,
22- typeOrmModulePartialOptions,
23- } from './defaults/indexer-config';
20+ import { getDatabaseConfig } from './defaults/indexer-config';
2421import { IConfig, VerifierServerConfig } from './interfaces/common';
2522import { Web2JsonConfig, Web2JsonSource } from './interfaces/web2-json';
2623import { WEB2_JSON_TEST_SOURCES } from './web2/web2-json-test-sources';
@@ -146,11 +143,19 @@ function getIndexerConfig(verifierType: ChainType): IndexerConfig {
146143 case ChainType.DOGE:
147144 case ChainType.XRP: {
148145 const entities = getDatabaseEntities(verifierType);
146+ const databaseConfig = getDatabaseConfig();
147+ const typeOrmModulePartialOptions: TypeOrmModuleOptions = {
148+ ...databaseConfig,
149+ type: 'postgres',
150+ synchronize: false,
151+ migrationsRun: false,
152+ logging: false,
153+ };
149154 const typeOrmModuleOptions: TypeOrmModuleOptions = {
150155 ...typeOrmModulePartialOptions,
151156 entities,
152157 };
153- return { db: database , typeOrmModuleOptions };
158+ return { db: databaseConfig , typeOrmModuleOptions };
154159 }
155160 case ChainType.Web2:
156161 throw new Error('Web2 verifier does not use indexer config');
Original file line number Diff line number Diff line change 1- import { TypeOrmModuleOptions } from '@nestjs/typeorm ';
1+ import { DatabaseConfig } from '../interfaces/chain-indexer ';
22
3- export const database = {
4- database: process.env.DB_DATABASE || 'database',
5- host: process.env.DB_HOST || '127.0.0.1',
6- port: parseInt(process.env.DB_PORT) || 8080,
7- username: process.env.DB_USERNAME || 'username',
8- password: process.env.DB_PASSWORD || 'password',
9- };
10- export const typeOrmModulePartialOptions: TypeOrmModuleOptions = {
11- ...database,
12- type: 'postgres',
13- synchronize: false,
14- migrationsRun: false,
15- logging: false,
16- };
3+ export function getDatabaseConfig(): DatabaseConfig {
4+ return {
5+ database: process.env.DB_DATABASE || 'database',
6+ host: process.env.DB_HOST || '127.0.0.1',
7+ port: parseInt(process.env.DB_PORT) || 8080,
8+ username: process.env.DB_USERNAME || 'username',
9+ password: process.env.DB_PASSWORD || 'password',
10+ };
11+ }
You can’t perform that action at this time.
0 commit comments