diff --git a/server/app/configurations/constants.js b/server/app/configurations/constants.js index 58824ede..b487c4c6 100644 --- a/server/app/configurations/constants.js +++ b/server/app/configurations/constants.js @@ -1,8 +1,8 @@ import path from 'path' import readConfig from 'read-config' - const config = readConfig(path.resolve(__dirname, '../../config.json')); +var os = require("os"); const defaultConfig = { env: config.NODE_ENV, @@ -14,7 +14,7 @@ const defaultConfig = { }; }, port: config.MIDDLEWARE_SERVER_PORT || 8010, - ip: config.MIDDLEWARE_SERVER_IP || 'localhost', + ip: config.MIDDLEWARE_SERVER_IP || os.hostname(), release: require('../../package.json').version, baseDir: path.normalize(__dirname + '/../..'), apiPrefix: config.APP_PREFIX || '/middleware/api', diff --git a/server/config.example.json b/server/config.example.json index f6f31e0a..fe88021f 100644 --- a/server/config.example.json +++ b/server/config.example.json @@ -1,10 +1,14 @@ { "MIDDLEWARE_SERVER_PORT": 8010, - "MIDDLEWARE_SERVER_IP": "localhost", + // + // leave empty or use fqdn on production (e.g. vsd-1.mvdcdev20.us.alcatel-lucent.com) + // "MIDDLEWARE_SERVER_IP": "localhost", + // + // use actual fqdn on production (e.g. elastic-1.mvdcdev20.us.alcatel-lucent.com) + // "APP_ELASTICSEARCH_HOST": "http://localhost:9200", - "REACT_APP_VSD_API_ENDPOINT": "https://vsd.com:8443/nuage/api/", "APP_PREFIX": "/middleware/api", "HTTPS_KEY_PATH": null, "HTTPS_CERT_PATH": null, "NODE_ENV": "development" // possible env - test, development, production -} \ No newline at end of file +} diff --git a/src/services/configurations/index.js b/src/services/configurations/index.js index 7fac61ef..3b89e278 100644 --- a/src/services/configurations/index.js +++ b/src/services/configurations/index.js @@ -1,10 +1,10 @@ import "whatwg-fetch"; import { checkStatus, parseJSON } from "../common"; - +var os = require("os"); const config = { path: process.env.PUBLIC_URL + "/configurations/", - api: process.env.REACT_APP_API_URL ? process.env.REACT_APP_API_URL : "http://localhost:8010/middleware/api/", + api: process.env.REACT_APP_API_URL ? process.env.REACT_APP_API_URL : "https://" + os.hostname() + ":8010/middleware/api/", cachingTime: 120000, // (ms) -> default 30s } diff --git a/src/services/servicemanager/index.js b/src/services/servicemanager/index.js index 73f631a6..c7a8b0d4 100644 --- a/src/services/servicemanager/index.js +++ b/src/services/servicemanager/index.js @@ -6,9 +6,10 @@ import { DatasetService } from "../dataset"; import "whatwg-fetch"; import { checkStatus, parseJSON } from "../common"; +var os = require("os"); let config = { timingCache: 30000, - api: process.env.REACT_APP_API_URL || "http://localhost:8010/middleware/api/", + api: process.env.REACT_APP_API_URL || "https://" + os.hostname() + ":8010/middleware/api/", } /*