Skip to content

Commit

Permalink
add: add phase configs
Browse files Browse the repository at this point in the history
  • Loading branch information
yaroslav-fedyshyn-nordwhale committed Jul 24, 2020
1 parent 2e5170a commit 3d29340
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .env.example
Expand Up @@ -9,6 +9,10 @@ MNEMONIC=choice congress hobby buddy dutch busy army eager empty solution start
INFURA_API=
NETWORK=production
LOG_LEVEL=trace
# App release/phase version
RELEASE_PHASE=
PHASE_ZERO=
PHASE_ONE=
PLIVO_AUTH_ID=MADSFJASDF2341ASDF0G
PLIVO_AUTH_TOKEN=YWRiMl2nomwsdfoQeTBadk9290dkmEAVB13zg5G5
PLIVO_PHONE_NUMBER=1555555555
Expand Down
18 changes: 18 additions & 0 deletions src/server/server.config.js
Expand Up @@ -24,6 +24,12 @@ const conf = convict({
default: version,
env: 'VERSION'
},
phase: {
doc: 'The application release/phase version',
format: Number,
default: -1,
env: 'RELEASE_PHASE'
},
logLevel: {
doc: 'Log level',
format: ['error', 'warn', 'info', 'debug', 'silent'],
Expand Down Expand Up @@ -511,6 +517,18 @@ const mainNetworkId = get(ContractsAddress, `${network}-mainnet.networkId`, netw
conf.set('ethereumMainnet', networks[mainNetworkId])
conf.set('ethereum', networks[networkId])

// phase options - compatibility with old phase env vars (PHASE_ZERO, PHASE_ONE)
const phase = conf.get('phase')

if (phase < 0) {
const detectPhase = 'true' === process.env.PHASE_ONE ? 1 : 0

conf.set('phase', detectPhase)
conf.set('isPhaseZero', 0 === detectPhase)
conf.set('isPhaseOne', 1 === detectPhase)
conf.set('isPhaseTwo', 2 === detectPhase)
}

// GUN S3 options
const privateS3 = process.env.GUN_PRIVATE_S3
const publicS3 = process.env.GUN_PUBLIC_S3
Expand Down

0 comments on commit 3d29340

Please sign in to comment.