Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
},
host: {
doc: 'Optional. URL to remote docker host',
format: String,
default: undefined
},
port: {
doc: 'Optional. Port on remote docker host',
format: 'port_or_windows_named_pipe',
default: undefined
}
}
});
// Load environment dependent configuration
convict.addParser({ extension: ['yml', 'yaml'], parse: yaml.safeLoad });
var config_dir = process.env.config_dir || "./config";
console.log("Loading settings from " + config_dir);
//Check if the configuration file exists, if it doesn't then skip this
try{
if (fs.existsSync(config_dir + '/configuration.yaml')) {
config.loadFile(config_dir + '/configuration.yaml');
}
} catch(err) {
console.warn("No configuration file detected. Using default settings");
}
// Perform validation
config.validate({allowed: 'warn'});
module.exports = config;
const fs = require('fs');
const path = require('path');
const yaml = require('js-yaml');
const convict = require('convict');
convict.addParser({extension: ['yml', 'yaml'], parse: yaml.safeLoad});
const config = convict({
application: {
config: {
doc: 'name of the config to load',
format: function check(val) {
if (!/^.+$/.test(val)) {
throw new Error('must be a string or number');
}
},
default: 'default',
env: 'CONFIG',
arg: 'config',
},
debug: {
doc: 'enable debug',
import convict from 'convict';
import yaml from 'js-yaml';
import json5 from 'json5';
convict.addParser([
{ extension: 'json', parse: JSON.parse },
{ extension: ['yaml', 'yml'], parse: yaml.safeLoad },
{ extension: ['json5'], parse: json5.parse },
]);
function logLevel(options) {
return {
doc: 'The level of logging to be recorded',
format: ['error', 'info', 'verbose', 'debug', 'silly'],
...options,
};
}
function logPath(options) {
return {
doc: 'Where the logs will be recorded to',