How to use the lisk-framework.configurator.loadConfig function in lisk-framework

To help you get started, we’ve selected a few lisk-framework examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github LiskHQ / lisk-core / scripts / update_config.js View on Github external
if (typeof network === 'undefined') {
	console.error('No network is provided');
	process.exit(1);
}

// TODO: Default config is not accessible this way right now
// 	Will be fixed with https://github.com/LiskHQ/lisk/issues/3171
const appConfig = {
	app: {
		version: packageJSON.version,
		minVersion: packageJSON.lisk.minVersion,
		protocolVersion: packageJSON.lisk.protocolVersion,
	},
};
configurator.loadConfig(appConfig);
const defaultConfig = configurator.getConfig({}, { failOnInvalidArg: false });

const networkConfig = loadJSONFileIfExists(
	path.resolve(rootPath, `config/${network}/config.json`)
);

const unifiedNewConfig = _.merge({}, defaultConfig, networkConfig);

const userConfig = loadJSONFileIfExists(configFilePath);

const history = new JSONHistory('lisk config file', console);

const moveElement = (config, pathFrom, pathTo) => {
	config = _.set(config, pathTo, _.get(config, pathFrom));
	config = _.omit(config, pathFrom);
	return config;
github LiskHQ / lisk-sdk-examples / lisk / src / helpers / config.ts View on Github external
const appConfig = {
	app: {
		version: packageJSON.version,
		minVersion: packageJSON.lisk.minVersion,
		protocolVersion: packageJSON.lisk.protocolVersion,
		lastCommitId,
		buildVersion,
	},
};

// Support for PROTOCOL_VERSION only for tests
if (process.env.NODE_ENV === 'test' && process.env.PROTOCOL_VERSION) {
	appConfig.app.protocolVersion = process.env.PROTOCOL_VERSION;
}

configurator.loadConfig(appConfig);

const { NETWORK, CUSTOM_CONFIG_FILE } = configurator.getConfig();

// Variable is used to identify different networks on NewRelic
process.env.LISK_NETWORK = NETWORK;

configurator.loadConfigFile(
	path.resolve(__dirname, `../../config/${NETWORK}/config`)
);

if (CUSTOM_CONFIG_FILE) {
	configurator.loadConfigFile(path.resolve(CUSTOM_CONFIG_FILE));
}

const config = configurator.getConfig();