Add CIC namespace to environment variables.

This commit is contained in:
Spencer Ofwiti 2021-03-18 20:16:43 +03:00
parent ec2d5321ba
commit d1563092b2
2 changed files with 25 additions and 24 deletions

View File

@ -1,9 +1,11 @@
CHAIN_ID=
LOGGING_URL=
META_URL=
KEYS_URL=
CACHE_URL=
WEB3_PROVIDER=
USSD_URL=
REGISTRY_ADDRESS=
TRUSTED_ADDRESS=
LOG_LEVEL=
SERVER_LEVEL=
CIC_CHAIN_ID=
CIC_LOGGING_URL=
CIC_META_URL=
CIC_KEYS_URL=
CIC_CACHE_URL=
CIC_WEB3_PROVIDER=
CIC_USSD_URL=
CIC_REGISTRY_ADDRESS=
CIC_TRUSTED_ADDRESS=

View File

@ -12,17 +12,17 @@ const environmentVars = `import {NgxLoggerLevel} from 'ngx-logger';
export const environment = {
production: ${isProduction},
bloxbergChainId: ${process.env.CHAIN_ID || 8996},
bloxbergChainId: ${process.env.CIC_CHAIN_ID || 8996},
level: ${process.env.LOG_LEVEL || 'NgxLoggerLevel.OFF'},
serverLogLevel: ${process.env.SERVER_LEVEL || 'NgxLoggerLevel.OFF'},
loggingUrl: '${process.env.LOGGING_URL || 'http://localhost:8000'}',
cicMetaUrl: '${process.env.META_URL || 'https://meta.dev.grassrootseconomics.net'}',
publicKeysUrl: '${process.env.KEYS_URL || 'http://localhost:8000/keys.asc'}',
cicCacheUrl: '${process.env.CACHE_URL || 'https://cache.dev.grassrootseconomics.net'}',
web3Provider: '${process.env.WEB3_PROVIDER || 'ws://localhost:63546'}',
cicUssdUrl: '${process.env.USSD_URL || 'https://ussd.dev.grassrootseconomics.net'}',
registryAddress: '${process.env.REGISTRY_ADDRESS || '0x6Ca3cB14aA6F761712E1C18646AfBA4d5Ae249E8'}',
trustedDeclaratorAddress: '${process.env.TRUSTED_ADDRESS || '0xEb3907eCad74a0013c259D5874AE7f22DcBcC95C'}'
loggingUrl: '${process.env.CIC_LOGGING_URL || 'http://localhost:8000'}',
cicMetaUrl: '${process.env.CIC_META_URL || 'https://meta.dev.grassrootseconomics.net'}',
publicKeysUrl: '${process.env.CIC_KEYS_URL || 'http://localhost:8000/keys.asc'}',
cicCacheUrl: '${process.env.CIC_CACHE_URL || 'https://cache.dev.grassrootseconomics.net'}',
web3Provider: '${process.env.CIC_WEB3_PROVIDER || 'ws://localhost:63546'}',
cicUssdUrl: '${process.env.CIC_USSD_URL || 'https://ussd.dev.grassrootseconomics.net'}',
registryAddress: '${process.env.CIC_REGISTRY_ADDRESS || '0x6Ca3cB14aA6F761712E1C18646AfBA4d5Ae249E8'}',
trustedDeclaratorAddress: '${process.env.CIC_TRUSTED_ADDRESS || '0xEb3907eCad74a0013c259D5874AE7f22DcBcC95C'}'
};
`;
@ -31,22 +31,21 @@ function setConfigs(configs): void {
if (err) {
throw console.error(err);
} else {
console.log(colors.cyan(`Wrote variables to '${targetPath}`));
console.log(colors.green(`Wrote variables to '${targetPath}`));
}
});
}
if (!process.env.REGISTRY_ADDRESS) {
console.error(colors.redBright('All the required environment variables were not provided!'));
if (!process.env.CIC_REGISTRY_ADDRESS) {
console.error(colors.red('All the required environment variables were not provided!'));
process.exit(-1);
}
console.log(colors.yellow(process.env.REGISTRY_ADDRESS));
if (isProduction) {
console.log(colors.magenta('Running in production environment!'));
console.log(colors.cyan('Running in production environment!'));
setConfigs(environmentVars);
} else {
console.log(colors.green('Running in development environment!'));
console.log(colors.cyan('Running in development environment!'));
setConfigs(environmentVars);
}