Skip to content
This repository has been archived by the owner on Nov 14, 2019. It is now read-only.

Flag for port and host #130

Merged
merged 1 commit into from
Aug 18, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/root-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,20 @@ export default abstract class extends Command {
help: flags.help({char: 'h'}),
quiet: flags.boolean({char: 'q', description: 'Display only essential information'}),
silent: flags.boolean({hidden: true}),
port: flags.integer({char: 'p', default: 50052, description: 'Port to access the MESG engine'}),
host: flags.string({default: 'localhost', description: 'Host to access the MESG engine'})
}

public api: API
private readonly _app: Application

constructor(argv: string[], config: IConfig) {
super(argv, config)
const port = 50052
const {flags} = this.parse()
const port = flags.port
const host = process.env.DOCKER_HOST
? new URL(process.env.DOCKER_HOST).hostname
: 'localhost'
: flags.host
const endpoint = `${host}:${port}`
this.api = createApi(endpoint)
this._app = application({endpoint})
Expand Down