Skip to content

Commit

Permalink
Merge pull request #313 from FlowFuse/312-use-port-from-config
Browse files Browse the repository at this point in the history
Use port from config file
  • Loading branch information
knolleary authored Sep 6, 2024
2 parents 7b67db2 + 0da37e8 commit de6212f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
5 changes: 4 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,10 @@ Please ensure the parent directory is writable, or set a different path with -d`
return {
AgentManager,
webServer,
options
options: {
...ConfigLoader.defaults,
...options
}
}
}
return null
Expand Down
4 changes: 0 additions & 4 deletions lib/cli/args.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ module.exports = [
name: 'port',
alias: 'p',
type: Number,
defaultValue: 1880,
typeLabel: '{underline number}',
group: 'main'
},
Expand Down Expand Up @@ -67,22 +66,19 @@ module.exports = [
name: 'ui',
description: 'Start the Web UI Server (optional, does not run by default)',
type: Boolean,
defaultValue: false,
alias: 'w',
group: 'ui'
},
{
name: 'ui-host',
description: 'Web UI server host. Default: {underline (0.0.0.0)} (listen on all interfaces)',
type: String,
defaultValue: '0.0.0.0',
group: 'ui'
},
{
name: 'ui-port',
description: 'Web UI server port. Default: {underline 1879}',
type: Number,
defaultValue: 1879,
group: 'ui'
},
{
Expand Down
12 changes: 11 additions & 1 deletion lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,19 @@ const yaml = require('yaml')
* @property {string} [deviceVersion] - The device version
* @property {string} [deviceDescription] - The device description
*/

const defaults = {
port: 1880,
ui: false,
uiHost: '0.0.0.0',
uiPort: 1879
}

module.exports = {
parseDeviceConfigFile,
parseDeviceConfig,
config
config,
defaults
}

/**
Expand Down Expand Up @@ -139,6 +148,7 @@ function config (options) {

return {
version,
...defaults,
...parsedOptions.deviceConfig,
...options
}
Expand Down

0 comments on commit de6212f

Please sign in to comment.