@@ -13,11 +13,7 @@ import helmet from 'helmet';
1313import { ApiKeyStrategy } from '../../../src/auth/apikey.strategy' ;
1414import { AuthModule } from '../../../src/auth/auth.module' ;
1515import { AuthService } from '../../../src/auth/auth.service' ;
16- import {
17- getDatabaseEntities ,
18- IConfig ,
19- VerifierServerConfig ,
20- } from '../../../src/config/configuration' ;
16+ import { getDatabaseEntities } from '../../../src/config/configuration' ;
2117import { XRPAddressValidityVerifierController } from '../../../src/controllers/address-validity-verifier.controller' ;
2218import { XRPBalanceDecreasingTransactionVerifierController } from '../../../src/controllers/balance-decreasing-transaction-verifier.controller' ;
2319import { XRPConfirmedBlockHeightExistsVerifierController } from '../../../src/controllers/confirmed-block-height-exists-verifier.controller' ;
@@ -32,6 +28,11 @@ import { XRPConfirmedBlockHeightExistsVerifierService } from '../../../src/servi
3228import { XrpExternalIndexerEngineService } from '../../../src/services/indexer-services/xrp-indexer.service' ;
3329import { XRPPaymentVerifierService } from '../../../src/services/payment-verifier.service' ;
3430import { XRPReferencedPaymentNonexistenceVerifierService } from '../../../src/services/referenced-payment-nonexistence-verifier.service' ;
31+ import {
32+ IConfig ,
33+ VerifierServerConfig ,
34+ } from '../../../src/config/interfaces/common' ;
35+ import { IndexerConfig } from '../../../src/config/interfaces/chain-indexer' ;
3536
3637function getConfig ( ) {
3738 const api_keys = process . env . API_KEYS ?. split ( ',' ) || [ '' ] ;
@@ -66,14 +67,16 @@ function getConfig() {
6667 port : parseInt ( process . env . PORT || '3120' ) ,
6768 api_keys,
6869 verifierConfig,
69- db : db ,
70- typeOrmModuleOptions : {
71- ...db ,
72- type : 'postgres' ,
73- entities : entities ,
74- synchronize : false ,
75- migrationsRun : false ,
76- logging : false ,
70+ indexerConfig : {
71+ db,
72+ typeOrmModuleOptions : {
73+ ...db ,
74+ type : 'postgres' ,
75+ entities : entities ,
76+ synchronize : false ,
77+ migrationsRun : false ,
78+ logging : false ,
79+ } ,
7780 } ,
7881 isTestnet,
7982 } ;
@@ -88,8 +91,15 @@ function getConfig() {
8891 } ) ,
8992 TypeOrmModule . forRootAsync ( {
9093 imports : [ ConfigModule ] ,
91- useFactory : ( config : ConfigService < IConfig > ) =>
92- config . get ( 'typeOrmModuleOptions' ) ,
94+ useFactory : ( config : ConfigService < IConfig > ) => {
95+ const indexerConfig : IndexerConfig = config . get ( 'indexerConfig' ) ;
96+ if ( ! indexerConfig ?. typeOrmModuleOptions ) {
97+ throw new Error (
98+ "'typeOrmModuleOptions' is missing in the configuration" ,
99+ ) ;
100+ }
101+ return indexerConfig . typeOrmModuleOptions ;
102+ } ,
93103 inject : [ ConfigService ] ,
94104 } ) ,
95105 AuthModule ,
0 commit comments