@ -1,3 +1,6 @@
var debug = require ( "debug" ) ;
var debugLog = debug ( "btcexp:config" ) ;
var fs = require ( 'fs' ) ;
var crypto = require ( 'crypto' ) ;
var url = require ( 'url' ) ;
@ -33,15 +36,33 @@ for (var i = 0; i < electrumXServerUriStrings.length; i++) {
electrumXServers . push ( { protocol : uri . protocol . substring ( 0 , uri . protocol . length - 1 ) , host : uri . hostname , port : parseInt ( uri . port ) } ) ;
}
[ "BTCEXP_DEMO" , "BTCEXP_PRIVACY_MODE" , "BTCEXP_NO_INMEMORY_RPC_CACHE" ] . forEach ( function ( item ) {
// default=false env vars
[
"BTCEXP_DEMO" ,
"BTCEXP_PRIVACY_MODE" ,
"BTCEXP_NO_INMEMORY_RPC_CACHE" ,
"BTCEXP_RPC_ALLOWALL"
] . forEach ( function ( item ) {
if ( process . env [ item ] === undefined ) {
process . env [ item ] = "false" ;
debugLog ( ` Config(default): ${ item } =false ` )
}
} ) ;
[ "BTCEXP_NO_RATES" , "BTCEXP_UI_SHOW_TOOLS_SUBHEADER" , "BTCEXP_SLOW_DEVICE_MODE" ] . forEach ( function ( item ) {
// default=true env vars
[
"BTCEXP_NO_RATES" ,
"BTCEXP_UI_SHOW_TOOLS_SUBHEADER" ,
"BTCEXP_SLOW_DEVICE_MODE"
] . forEach ( function ( item ) {
if ( process . env [ item ] === undefined ) {
process . env [ item ] = "true" ;
debugLog ( ` Config(default): ${ item } =true ` )
}
} ) ;
@ -59,7 +80,7 @@ module.exports = {
rpcConcurrency : ( process . env . BTCEXP_RPC_CONCURRENCY || 10 ) ,
rpcBlacklist :
process . env . BTCEXP_RPC_ALLOWALL ? [ ]
process . env . BTCEXP_RPC_ALLOWALL . toLowerCase ( ) == "true" ? [ ]
: process . env . BTCEXP_RPC_BLACKLIST ? process . env . BTCEXP_RPC_BLACKLIST . split ( ',' ) . filter ( Boolean )
: [
"addnode" ,
@ -206,3 +227,8 @@ module.exports = {
}
}
} ;
debugLog ( ` Config(final): privacyMode= ${ module . exports . privacyMode } ` ) ;
debugLog ( ` Config(final): slowDeviceMode= ${ module . exports . slowDeviceMode } ` ) ;
debugLog ( ` Config(final): demo= ${ module . exports . demoSite } ` ) ;
debugLog ( ` Config(final): rpcAllowAll= ${ module . exports . rpcBlacklist . length == 0 } ` ) ;