//the master config of which all other config files get their data from
const config = {
    //USER CONFIGURABLE PROPERTIES

    //the port that the web server binds to
    httpPort: process.env.HTTP_PORT || 4000,
    //enables usage of json web tokens as the form of unique identification
    jwtSecret: process.env.JWT_SECRET,
    //the address of the nomad and consul client. assumes manticore is launched by nomad
    clientAgentIp: process.env.NOMAD_IP_http || 'localhost',
    nomadAgentPort: process.env.NOMAD_AGENT_PORT || 4646, //the port the nomad agent listens on
    consulAgentPort: process.env.CONSUL_AGENT_PORT || 8500, //the port the consul agent listens on
    consulDnsPort: process.env.CONSUL_DNS_PORT || 8600, //the port the consul DNS server listens on
    logLevel: process.env.LOG_LEVEL || 'debug', //the logging level of manticore to stdout
    //the folder under /api to load from. only one version is allowed to run at a time
    apiVersion: process.env.API_VERSION || 'v2',
    haproxyPort: process.env.HAPROXY_HTTP_PORT, //the port haproxy listens on for http traffic
    haproxyDomain: process.env.DOMAIN_NAME, //the domain under which clients will connect to the server
    tcpPortStart: process.env.TCP_PORT_RANGE_START, //the smallest port haproxy can bind to for tcp
    tcpPortEnd: process.env.TCP_PORT_RANGE_END, //the largest port haproxy can bind to for tcp
    //reserved properties for manticore's use
    //how long a user is allowed to use the Manticore service uninterrupted (in seconds)
    usageDuration: process.env.USAGE_DURATION,
    //how long a user has after being warned to send a websocket message to Manticore before being booted
    //off the instance (in seconds). The total time a user has to use Manticore while idling is therefore
    //usageDuration + warningDuration
    warningDuration: process.env.WARNING_DURATION,
    //whether a client can send a websocket message to reset the amount of time before a user is removed
    //from Manticore. Enable this if you want to enforce a max limit of how long a user can use their jobs
    resetTimerAllowed: process.env.RESET_TIMER_ALLOWED,
    //whether the simple Manticore webpage will be served
    webpageDisabled: process.env.WEBPAGE_DISABLED || false,

    //RESERVED PROPERTIES FOR MANTICORE'S USE

    //manticore interface modules
    logger: null,
	store: null,
    job: null,
	websocket: null,

    //manticore modes and whether they're enabled
    modes: {
        haproxy: false,
        inactivityTimer: false,
        jwt: false
    }
};

//provide properties to easily determine whether certain modes of manticore are enabled

if (config.haproxyPort !== undefined
    && config.haproxyDomain !== undefined
    && config.tcpPortStart !== undefined
    && config.tcpPortEnd !== undefined) {
    config.modes.haproxy = true;
}
if (config.usageDuration !== undefined
    && config.warningDuration !== undefined
    && config.resetTimerAllowed !== undefined) {
    config.modes.inactivityTimer = true;
}
if (config.jwtSecret !== undefined) {
    config.modes.jwtEnabled = true;
}

//convert strings to booleans for certain properties
if (config.resetTimerAllowed === "false") {
    config.resetTimerAllowed = false;
}
if (config.resetTimerAllowed === "true") {
    config.resetTimerAllowed = true;
}

//convert strings to numbers for certain properties
if (config.httpPort !== undefined) {
    config.httpPort = Number(config.httpPort);
}
if (config.nomadAgentPort !== undefined) {
    config.nomadAgentPort = Number(config.nomadAgentPort);
}
if (config.consulAgentPort !== undefined) {
    config.consulAgentPort = Number(config.consulAgentPort);
}
if (config.consulDnsPort !== undefined) {
    config.consulDnsPort = Number(config.consulDnsPort);
}
if (config.tcpPortStart !== undefined) {
    config.tcpPortStart = Number(config.tcpPortStart);
}
if (config.tcpPortEnd !== undefined) {
    config.tcpPortEnd = Number(config.tcpPortEnd);
}

module.exports = config;

@@ -3301,32 +3301,190 @@
 llowed = true;%0A%7D
+%0Aif (config.webpageDisabled === %22false%22) %7B%0A    config.webpageDisabled = false;%0A%7D%0Aif (config.webpageDisabled === %22true%22) %7B%0A    config.webpageDisabled = true;%0A%7D
 %0A%0A//convert stri

webpageDisabled coerce to boolean