fix(core): Refactored configuration management classes and improved service update handling
This commit is contained in:
@@ -45,6 +45,50 @@ export const runCli = async () => {
|
||||
smartcliInstance.addCommand('asdaemon').subscribe(async (argvArg) => {
|
||||
logger.log('success', 'looks like we are running as daemon now');
|
||||
logger.log('info', 'starting spark in daemon mode');
|
||||
|
||||
// lets determine the mode if specified
|
||||
let mode = argvArg.mode;
|
||||
if (mode === 'cloudly') {
|
||||
await sparkInstance.sparkConfig.kvStore.writeKey('mode', 'cloudly');
|
||||
} else if (mode === 'coreflow-node') {
|
||||
await sparkInstance.sparkConfig.kvStore.writeKey('mode', 'coreflow-node');
|
||||
} else if (mode) {
|
||||
logger.log('error', 'unknown mode specified');
|
||||
process.exit(1);
|
||||
} else {
|
||||
// mode is not specified by cli, lets get it from the config
|
||||
mode = await sparkInstance.sparkConfig.kvStore.readKey('mode');
|
||||
}
|
||||
|
||||
if (!mode) {
|
||||
logger.log('error', 'no mode specified by either cli or config');
|
||||
process.exit(1);
|
||||
} else if (mode === 'cloudly') {
|
||||
sparkInstance.sparkUpdateManager.services.push({
|
||||
name: `coreflow`,
|
||||
image: `code.foss.global/serve.zone/cloudly`,
|
||||
url: `cloudly`,
|
||||
environment: `production`,
|
||||
port: `3000`,
|
||||
secretJson: {
|
||||
SERVEZONE_PORT: `3000`,
|
||||
SERVEZONE_ENVIRONMENT: `production`,
|
||||
},
|
||||
});
|
||||
} else if (mode === 'coreflow-node') {
|
||||
sparkInstance.sparkUpdateManager.services.push({
|
||||
name: `coreflow`,
|
||||
image: `code.foss.global/serve.zone/coreflow`,
|
||||
url: `coreflow`,
|
||||
environment: `production`,
|
||||
port: `3000`,
|
||||
secretJson: {
|
||||
SERVEZONE_PORT: `3000`,
|
||||
SERVEZONE_ENVIRONMENT: `production`,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
await sparkInstance.daemonStart();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user