config.js 2.2 KB
/* ------------- [START SERVER CONFIG VARIABLES] ------------ */
var config = {
    development: {
      app_name: "CMF",
      app_host: "0.0.0.0",
      app_port: "3000",
      app_https: false, 
      KEY: "key1.pem",
      CERT: "cert1.pem",
      service: {
        PANDORA: {
          // URI : 'http://25.27.7.151:34618',   //JBOSS IOT
          URI : 'http://25.27.7.151:34680',   //JBOSS DEV
          URI_EQX: "http://25.27.7.151:15300", //EQUINOX
          //URI: "http://localhost:8080",
          KEY: "./PANDORA_CERT/server.key",
          CERT: "./PANDORA_CERT/server.pem",
          PREFIX: "/phxPartner/v1/partner"
        },
        SPW:{
          Name : "SPW API",
          POST_SearchCustomer_URL : "http://10.1.3.172:8080",
          POST_SearchCustomer_Timeout : 10 

        },
        D01:{
          Name : "CMF DB",
          GET_Customer_URL : "http://10.1.2.144:8080",
          GET_Customer_Timeout : 10, 
          POST_Customer_URL : "http://10.1.2.144:8080",
          POST_Customer_Timeout : 10

        }
      },
      http_req_timeout: 120,
      session: 30, //minutes
      Default_Timeout: 10
    }
  };
  /* ------------- [END SERVER CONFIG VARIABLES] ------------ */
  
  /* ------------- [START SERVER GET FUNTION] ------------ */
  exports.get = function get(env) {
    var cfg = config[env] || config.development;
    cfg.app_host = process.env.APP_HOST || cfg.app_host;
    cfg.app_port = process.env.APP_PORT || cfg.app_port;
    cfg.app_https = process.env.USE_HTTPS || cfg.app_https;
    cfg.db_ip_port = process.env.DATABASE_IP_PORT || cfg.db_ip_port;
    cfg.pandora_key = process.env.PANDORA_KEY || cfg.pandora_key;
    cfg.pandora_cert = process.env.PANDORA_CERT || cfg.pandora_cert;
    cfg.KEY = process.env.KEY || cfg.KEY;
    cfg.CERT = process.env.CERT || cfg.CERT;
    cfg.tmp_path = process.env.TMP_PATH || cfg.tmp_path;
    var envService = null;
    try {
      if (process.env.SERVICE && process.env.SERVICE.length > 0) {
        envService = JSON.parse(process.env.SERVICE);
      }
    } catch (error) {
      envService = null;
    }
    cfg.service = envService != null ? envService : cfg.service;
    return cfg;
  };
  
  /* ------------- [END SERVER GET FUNTION] ------------ */