Merge pull request #3185 from mempool/nymkappa/historical-frontend-price-flag
Add frontend config flag to toggle historical price fetching
This commit is contained in:
		
						commit
						29498e136b
					
				@ -35,6 +35,7 @@ __AUDIT__=${AUDIT:=false}
 | 
				
			|||||||
__MAINNET_BLOCK_AUDIT_START_HEIGHT__=${MAINNET_BLOCK_AUDIT_START_HEIGHT:=0}
 | 
					__MAINNET_BLOCK_AUDIT_START_HEIGHT__=${MAINNET_BLOCK_AUDIT_START_HEIGHT:=0}
 | 
				
			||||||
__TESTNET_BLOCK_AUDIT_START_HEIGHT__=${TESTNET_BLOCK_AUDIT_START_HEIGHT:=0}
 | 
					__TESTNET_BLOCK_AUDIT_START_HEIGHT__=${TESTNET_BLOCK_AUDIT_START_HEIGHT:=0}
 | 
				
			||||||
__SIGNET_BLOCK_AUDIT_START_HEIGHT__=${SIGNET_BLOCK_AUDIT_START_HEIGHT:=0}
 | 
					__SIGNET_BLOCK_AUDIT_START_HEIGHT__=${SIGNET_BLOCK_AUDIT_START_HEIGHT:=0}
 | 
				
			||||||
 | 
					__HISTORICAL_PRICE__=${HISTORICAL_PRICE:=true}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Export as environment variables to be used by envsubst
 | 
					# Export as environment variables to be used by envsubst
 | 
				
			||||||
export __TESTNET_ENABLED__
 | 
					export __TESTNET_ENABLED__
 | 
				
			||||||
@ -60,6 +61,7 @@ export __AUDIT__
 | 
				
			|||||||
export __MAINNET_BLOCK_AUDIT_START_HEIGHT__
 | 
					export __MAINNET_BLOCK_AUDIT_START_HEIGHT__
 | 
				
			||||||
export __TESTNET_BLOCK_AUDIT_START_HEIGHT__
 | 
					export __TESTNET_BLOCK_AUDIT_START_HEIGHT__
 | 
				
			||||||
export __SIGNET_BLOCK_AUDIT_START_HEIGHT__
 | 
					export __SIGNET_BLOCK_AUDIT_START_HEIGHT__
 | 
				
			||||||
 | 
					export __HISTORICAL_PRICE__
 | 
				
			||||||
 | 
					
 | 
				
			||||||
folder=$(find /var/www/mempool -name "config.js" | xargs dirname)
 | 
					folder=$(find /var/www/mempool -name "config.js" | xargs dirname)
 | 
				
			||||||
echo ${folder}
 | 
					echo ${folder}
 | 
				
			||||||
 | 
				
			|||||||
@ -21,5 +21,6 @@
 | 
				
			|||||||
  "MAINNET_BLOCK_AUDIT_START_HEIGHT": 0,
 | 
					  "MAINNET_BLOCK_AUDIT_START_HEIGHT": 0,
 | 
				
			||||||
  "TESTNET_BLOCK_AUDIT_START_HEIGHT": 0,
 | 
					  "TESTNET_BLOCK_AUDIT_START_HEIGHT": 0,
 | 
				
			||||||
  "SIGNET_BLOCK_AUDIT_START_HEIGHT": 0,
 | 
					  "SIGNET_BLOCK_AUDIT_START_HEIGHT": 0,
 | 
				
			||||||
  "LIGHTNING": false
 | 
					  "LIGHTNING": false,
 | 
				
			||||||
 | 
					  "HISTORICAL_PRICE": true
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -70,7 +70,7 @@ export class PriceService {
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  getBlockPrice$(blockTimestamp: number, singlePrice = false): Observable<Price | undefined> {
 | 
					  getBlockPrice$(blockTimestamp: number, singlePrice = false): Observable<Price | undefined> {
 | 
				
			||||||
    if (this.stateService.env.BASE_MODULE !== 'mempool') {
 | 
					    if (this.stateService.env.BASE_MODULE !== 'mempool' || !this.stateService.env.HISTORICAL_PRICE) {
 | 
				
			||||||
      return of(undefined);
 | 
					      return of(undefined);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -43,6 +43,7 @@ export interface Env {
 | 
				
			|||||||
  MAINNET_BLOCK_AUDIT_START_HEIGHT: number;
 | 
					  MAINNET_BLOCK_AUDIT_START_HEIGHT: number;
 | 
				
			||||||
  TESTNET_BLOCK_AUDIT_START_HEIGHT: number;
 | 
					  TESTNET_BLOCK_AUDIT_START_HEIGHT: number;
 | 
				
			||||||
  SIGNET_BLOCK_AUDIT_START_HEIGHT: number;
 | 
					  SIGNET_BLOCK_AUDIT_START_HEIGHT: number;
 | 
				
			||||||
 | 
					  HISTORICAL_PRICE: boolean;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const defaultEnv: Env = {
 | 
					const defaultEnv: Env = {
 | 
				
			||||||
@ -72,6 +73,7 @@ const defaultEnv: Env = {
 | 
				
			|||||||
  'MAINNET_BLOCK_AUDIT_START_HEIGHT': 0,
 | 
					  'MAINNET_BLOCK_AUDIT_START_HEIGHT': 0,
 | 
				
			||||||
  'TESTNET_BLOCK_AUDIT_START_HEIGHT': 0,
 | 
					  'TESTNET_BLOCK_AUDIT_START_HEIGHT': 0,
 | 
				
			||||||
  'SIGNET_BLOCK_AUDIT_START_HEIGHT': 0,
 | 
					  'SIGNET_BLOCK_AUDIT_START_HEIGHT': 0,
 | 
				
			||||||
 | 
					  'HISTORICAL_PRICE': true,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@Injectable({
 | 
					@Injectable({
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user