(settingsObj: any)
| 942 | * both "settings.json" and "credentials.json". |
| 943 | */ |
| 944 | const storeSettings = (settingsObj: any) => { |
| 945 | for (const i of Object.keys(settingsObj || {})) { |
| 946 | if (nonSettings.includes(i)) { |
| 947 | logger.warn(`Ignoring setting: '${i}'`); |
| 948 | continue; |
| 949 | } |
| 950 | |
| 951 | // test if the setting starts with a lowercase character |
| 952 | if (i.charAt(0).search('[a-z]') !== 0) { |
| 953 | logger.warn(`Settings should start with a lowercase character: '${i}'`); |
| 954 | } |
| 955 | |
| 956 | // we know this setting, so we overwrite it |
| 957 | // or it's a settings hash, specific to a plugin |
| 958 | // @ts-ignore |
| 959 | if (settings[i] !== undefined || i.indexOf('ep_') === 0) { |
| 960 | if (_.isObject(settingsObj[i]) && !Array.isArray(settingsObj[i])) { |
| 961 | // @ts-ignore |
| 962 | settings[i] = _.defaults(settingsObj[i], settings[i]); |
| 963 | } else { |
| 964 | // @ts-ignore |
| 965 | settings[i] = settingsObj[i]; |
| 966 | } |
| 967 | } else { |
| 968 | // this setting is unknown, output a warning and throw it away |
| 969 | logger.warn(`Unknown Setting: '${i}'. This setting doesn't exist or it was removed`); |
| 970 | } |
| 971 | } |
| 972 | }; |
| 973 | |
| 974 | /* |
| 975 | * If stringValue is a numeric string, or its value is "true" or "false", coerce |
no test coverage detected