Skip to content

Commit

Permalink
agregado parametro host a repl
Browse files Browse the repository at this point in the history
  • Loading branch information
mind-ar committed May 30, 2024
1 parent d7724a8 commit 07695ab
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/commands/repl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export type Options = {
project: string
skipValidations: boolean,
darkMode: boolean,
host?: string,
port: string,
skipDiagram: boolean,
}
Expand Down Expand Up @@ -282,10 +283,10 @@ export async function initializeClient(options: Options, repl: Interface, interp
cors({ allowedHeaders: '*' }),
express.static(publicPath('diagram'), { maxAge: '1d' }),
)
const host = "0.0.0.0"
const host = options.host
server.listen(parseInt(options.port), host)
server.addListener('listening', () => {
logger.info(successDescription('Dynamic diagram available at: ' + bold(`http://127.0.0.1:${options.port}`)))
logger.info(successDescription('Dynamic diagram available at: ' + bold(`http://${host}:${options.port}`)))
repl.prompt()
})

Expand Down
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ program.command('run')
.option('-p, --project <path>', 'path to project', process.cwd())
.option('-a, --assets [path]', 'path relative to project for game assets. By default, it takes the assets definition from package.json.', 'assets')
.option('--skipValidations', 'skip code validation', false)
.option('--host [host]', 'host to run (bind) the server', 'localhost')
.option('--port [port]', 'port to run the server', '3000')
.option('-g, --game', 'sets the program as a game', false)
.option('-v, --verbose', 'print debugging information', false)
Expand All @@ -46,6 +47,7 @@ program.command('repl')
.option('--skipValidations', 'skip code validation', false)
.option('--darkMode', 'dark mode', false)
.option('--skipDiagram', 'avoid starting the server for the dynamic diagram', false)
.option('--host [host]', 'host to run (bind) the server', 'localhost')
.option('--port [port]', 'port to run the server', '3000')
.option('-v, --verbose', 'print debugging information', false)
.action(repl)
Expand Down

0 comments on commit 07695ab

Please sign in to comment.