Skip to content

Commit

Permalink
add enable index env
Browse files Browse the repository at this point in the history
  • Loading branch information
canonbrother committed Nov 22, 2023
1 parent 97c28a9 commit 64fb495
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions apps/whale-api/src/app.configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ export function AppConfiguration (): any {
/**
* Allows you to override whale endpoint version.
*/
enable: {
index: process.env.WHALE_ENABLE_INDEX
},
version: process.env.WHALE_VERSION,
network: process.env.WHALE_NETWORK,
defid: {
Expand All @@ -30,6 +33,7 @@ export function AppConfiguration (): any {
export function ENV_VALIDATION_SCHEMA (): any {
return Joi.object({
NODE_ENV: Joi.string().optional(),
WHALE_ENABLE_INDEX: Joi.bool().optional(),
WHALE_VERSION: Joi.string().optional(),
WHALE_NETWORK: Joi.string().valid('mainnet', 'testnet', 'regtest', 'devnet', 'changi').default('regtest'),
WHALE_DEFID_URL: Joi.string().optional(),
Expand Down
4 changes: 4 additions & 0 deletions apps/whale-api/src/module.indexer/rpc.block.provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ export class RPCBlockProvider {
return
}

if (process.env.WHALE_ENABLE_INDEX === 'false') {
return

Check warning on line 37 in apps/whale-api/src/module.indexer/rpc.block.provider.ts

View check run for this annotation

Codecov / codecov/patch

apps/whale-api/src/module.indexer/rpc.block.provider.ts#L37

Added line #L37 was not covered by tests
}

if (this.indexing) {
return
}
Expand Down

0 comments on commit 64fb495

Please sign in to comment.