Commit c7ef324b authored by Aral Balkan's avatar Aral Balkan

Make the port a command-line configuration option. Closes #7

parent 25376f1f
...@@ -13,6 +13,16 @@ For more information, please see the [Indienet project planning documentation at ...@@ -13,6 +13,16 @@ For more information, please see the [Indienet project planning documentation at
1. `npm install` 1. `npm install`
2. `npm run dev` 2. `npm run dev`
To specify a port (e.g., two run two separate instances when testing federation), use:
`npm run dev -- --port 7999`
## Production
Not ready for production use.
(In production, the port is set either via the PORT environment variable or will fall back to the value in the _config/production.json_ from the Feathers configuration.)
## Configuration ## Configuration
The site configuration is currently in the _assets/_ directory. This will change shortly to a location that can be easily included during deployment and one that isn’t checked into source control. The site configuration is currently in the _assets/_ directory. This will change shortly to a location that can be easily included during deployment and one that isn’t checked into source control.
......
...@@ -12983,6 +12983,14 @@ ...@@ -12983,6 +12983,14 @@
"lodash": "4.17.4" "lodash": "4.17.4"
} }
}, },
"is-fullwidth-code-point": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz",
"integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=",
"requires": {
"number-is-nan": "1.0.1"
}
},
"json5": { "json5": {
"version": "0.5.1", "version": "0.5.1",
"resolved": "https://registry.npmjs.org/json5/-/json5-0.5.1.tgz", "resolved": "https://registry.npmjs.org/json5/-/json5-0.5.1.tgz",
...@@ -12993,6 +13001,14 @@ ...@@ -12993,6 +13001,14 @@
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz",
"integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=" "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w="
}, },
"strip-ansi": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
"integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=",
"requires": {
"ansi-regex": "2.1.1"
}
},
"supports-color": { "supports-color": {
"version": "4.5.0", "version": "4.5.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz",
...@@ -13033,6 +13049,70 @@ ...@@ -13033,6 +13049,70 @@
"uglify-js": "2.8.29", "uglify-js": "2.8.29",
"webpack-sources": "1.1.0" "webpack-sources": "1.1.0"
} }
},
"yargs": {
"version": "8.0.2",
"resolved": "https://registry.npmjs.org/yargs/-/yargs-8.0.2.tgz",
"integrity": "sha1-YpmpBVsc78lp/355wdkY3Osiw2A=",
"requires": {
"camelcase": "4.1.0",
"cliui": "3.2.0",
"decamelize": "1.2.0",
"get-caller-file": "1.0.2",
"os-locale": "2.1.0",
"read-pkg-up": "2.0.0",
"require-directory": "2.1.1",
"require-main-filename": "1.0.1",
"set-blocking": "2.0.0",
"string-width": "2.1.1",
"which-module": "2.0.0",
"y18n": "3.2.1",
"yargs-parser": "7.0.0"
},
"dependencies": {
"camelcase": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz",
"integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0="
},
"cliui": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz",
"integrity": "sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0=",
"requires": {
"string-width": "1.0.2",
"strip-ansi": "3.0.1",
"wrap-ansi": "2.1.0"
},
"dependencies": {
"string-width": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz",
"integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=",
"requires": {
"code-point-at": "1.1.0",
"is-fullwidth-code-point": "1.0.0",
"strip-ansi": "3.0.1"
}
}
}
}
}
},
"yargs-parser": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-7.0.0.tgz",
"integrity": "sha1-jQrELxbqVd69MyyvTEA4s+P139k=",
"requires": {
"camelcase": "4.1.0"
},
"dependencies": {
"camelcase": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz",
"integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0="
}
}
} }
} }
}, },
...@@ -13308,74 +13388,48 @@ ...@@ -13308,74 +13388,48 @@
"integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=" "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI="
}, },
"yargs": { "yargs": {
"version": "8.0.2", "version": "11.0.0",
"resolved": "https://registry.npmjs.org/yargs/-/yargs-8.0.2.tgz", "resolved": "https://registry.npmjs.org/yargs/-/yargs-11.0.0.tgz",
"integrity": "sha1-YpmpBVsc78lp/355wdkY3Osiw2A=", "integrity": "sha512-Rjp+lMYQOWtgqojx1dEWorjCofi1YN7AoFvYV7b1gx/7dAAeuI4kN5SZiEvr0ZmsZTOpDRcCqrpI10L31tFkBw==",
"requires": { "requires": {
"camelcase": "4.1.0", "cliui": "4.0.0",
"cliui": "3.2.0",
"decamelize": "1.2.0", "decamelize": "1.2.0",
"find-up": "2.1.0",
"get-caller-file": "1.0.2", "get-caller-file": "1.0.2",
"os-locale": "2.1.0", "os-locale": "2.1.0",
"read-pkg-up": "2.0.0",
"require-directory": "2.1.1", "require-directory": "2.1.1",
"require-main-filename": "1.0.1", "require-main-filename": "1.0.1",
"set-blocking": "2.0.0", "set-blocking": "2.0.0",
"string-width": "2.1.1", "string-width": "2.1.1",
"which-module": "2.0.0", "which-module": "2.0.0",
"y18n": "3.2.1", "y18n": "3.2.1",
"yargs-parser": "7.0.0" "yargs-parser": "9.0.2"
}, },
"dependencies": { "dependencies": {
"camelcase": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz",
"integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0="
},
"cliui": { "cliui": {
"version": "3.2.0", "version": "4.0.0",
"resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz", "resolved": "https://registry.npmjs.org/cliui/-/cliui-4.0.0.tgz",
"integrity": "sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0=", "integrity": "sha512-nY3W5Gu2racvdDk//ELReY+dHjb9PlIcVDFXP72nVIhq2Gy3LuVXYwJoPVudwQnv1shtohpgkdCKT2YaKY0CKw==",
"requires": { "requires": {
"string-width": "1.0.2", "string-width": "2.1.1",
"strip-ansi": "3.0.1", "strip-ansi": "4.0.0",
"wrap-ansi": "2.1.0" "wrap-ansi": "2.1.0"
},
"dependencies": {
"string-width": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz",
"integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=",
"requires": {
"code-point-at": "1.1.0",
"is-fullwidth-code-point": "1.0.0",
"strip-ansi": "3.0.1"
}
}
}
},
"is-fullwidth-code-point": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz",
"integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=",
"requires": {
"number-is-nan": "1.0.1"
} }
}, },
"strip-ansi": { "find-up": {
"version": "3.0.1", "version": "2.1.0",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz",
"integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=",
"requires": { "requires": {
"ansi-regex": "2.1.1" "locate-path": "2.0.0"
} }
} }
} }
}, },
"yargs-parser": { "yargs-parser": {
"version": "7.0.0", "version": "9.0.2",
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-7.0.0.tgz", "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-9.0.2.tgz",
"integrity": "sha1-jQrELxbqVd69MyyvTEA4s+P139k=", "integrity": "sha1-nM9qQ0YP5O1Aqbto9I1DuKaMwHc=",
"requires": { "requires": {
"camelcase": "4.1.0" "camelcase": "4.1.0"
}, },
......
...@@ -43,7 +43,8 @@ ...@@ -43,7 +43,8 @@
"nuxt": "^1.3.0", "nuxt": "^1.3.0",
"serve-favicon": "^2.4.5", "serve-favicon": "^2.4.5",
"winston": "^2.4.0", "winston": "^2.4.0",
"ws": "^4.0.0" "ws": "^4.0.0",
"yargs": "^11.0.0"
}, },
"devDependencies": { "devDependencies": {
"eslint": "^4.18.0", "eslint": "^4.18.0",
......
/* eslint-disable no-console */ /* eslint-disable no-console */
const logger = require('winston') const logger = require('winston')
const app = require('./app') const app = require('./app')
const port = app.get('port') const portFromConfiguration = app.get('port')
const { argv } = require('yargs')
// Set the port:
//
// 1. Via commandline override (--port) if present
// 2. Via environment variable if present
// 3. Via the Feathers configuration file (fallback)
const port = argv.port || process.env.PORT || portFromConfiguration
process.on('unhandledRejection', (reason, p) => process.on('unhandledRejection', (reason, p) =>
logger.error('Unhandled Rejection at: Promise ', p, reason) logger.error('Unhandled Rejection at: Promise ', p, reason)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment