From 11d09a612c536eec6b1e379a94333f8f49fd9b8f Mon Sep 17 00:00:00 2001 From: maksimchepelev Date: Wed, 20 Feb 2019 15:55:13 +0300 Subject: [PATCH 1/3] feat(config): add dafault config values in js code increase stability. this allow to work without any config fix memory leack problem in jobs Closes ENG-630 --- src/config/constants.js | 33 +++++++++++++++++++++++++++++++++ src/config/index.js | 5 ++++- 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 src/config/constants.js diff --git a/src/config/constants.js b/src/config/constants.js new file mode 100644 index 000000000..c7329473e --- /dev/null +++ b/src/config/constants.js @@ -0,0 +1,33 @@ +/* + * ******************************************************************************* + * * Copyright (c) 2018 Edgeworx, Inc. + * * + * * This program and the accompanying materials are made available under the + * * terms of the Eclipse Public License v. 2.0 which is available at + * * http://www.eclipse.org/legal/epl-2.0 + * * + * * SPDX-License-Identifier: EPL-2.0 + * ******************************************************************************* + * + */ + +module.exports = { + 'App:Name': 'iofog-controller', + + 'Server:Port': 54421, + 'Server:DevMode': false, + + 'Email:ActivationEnabled': false, + 'Email:HomeUrl': 'https://iofog.org', + + 'Service:LogsDirectory': '/var/log/iofog-controller', + 'Service:LogsFileSize': 1048576, + + 'Settings:DefaultJobIntervalSeconds': 120, + 'Settings:UserTokenExpirationIntervalSeconds': 3600, + 'Settings:FogTokenExpirationIntervalSeconds': 3600, + 'Settings:FogStatusUpdateIntervalSeconds': 120, + 'Settings:FogStatusFrequencySeconds': 60, + + 'Diagnostics:DiagnosticDir': 'diagnostic', +} \ No newline at end of file diff --git a/src/config/index.js b/src/config/index.js index 8b10ec58d..ef00c26ae 100644 --- a/src/config/index.js +++ b/src/config/index.js @@ -14,6 +14,9 @@ const nconf = require('nconf') const path = require('path') + +const constants = require('./constants'); + class Config { constructor() { nconf.env({ separator: '_', }) @@ -22,7 +25,7 @@ class Config { } get(key) { - return nconf.get(key) + return nconf.get(key) || constants[key] } set(key, value) { From bd4da6d29f936de05146815875c96bc8785e4284 Mon Sep 17 00:00:00 2001 From: maksimchepelev Date: Wed, 20 Feb 2019 15:59:16 +0300 Subject: [PATCH 2/3] feat(config): add dafault config values in js code fix formatting Closes ENG-630 --- src/config/index.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/config/index.js b/src/config/index.js index ef00c26ae..bc5897449 100644 --- a/src/config/index.js +++ b/src/config/index.js @@ -13,8 +13,6 @@ const nconf = require('nconf') const path = require('path') - - const constants = require('./constants'); class Config { From f9d22bf5e23c70a31e68c22e88ca4716602de649 Mon Sep 17 00:00:00 2001 From: maksimchepelev Date: Wed, 20 Feb 2019 16:03:56 +0300 Subject: [PATCH 3/3] 9!!! --- src/config/constants.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config/constants.js b/src/config/constants.js index c7329473e..21dc6e958 100644 --- a/src/config/constants.js +++ b/src/config/constants.js @@ -1,6 +1,6 @@ /* * ******************************************************************************* - * * Copyright (c) 2018 Edgeworx, Inc. + * * Copyright (c) 2019 Edgeworx, Inc. * * * * This program and the accompanying materials are made available under the * * terms of the Eclipse Public License v. 2.0 which is available at