ethers-io / ethers-cli

Deprecated; please see the `@ethersproject/cli` package instead
https://github.com/ethers-io/ethers.js/tree/ethers-v5-beta/packages/cli
17 stars 13 forks source link

Added CLI option to configure served host #2

Closed gquemener closed 6 years ago

gquemener commented 6 years ago

This is especially usefull when using ethers-build through a docker container, one might pass --host 0.0.0.0 in order to correctly access the web server from the container host.

The current hardcoded value 127.0.0.1 prevents this.

This PR will allow using ethers-cli serve in a container and access the web server from the host.

Here's an example:

$ docker run --rm -ti -v "$(pwd):/app" -w /app -p "8080:8080" gquemener/node-toolbox:latest ethers-build serve --host 0.0.0.0 --port 8080
Serving content from file:///app
Listening on port: 8080
Server Ethers app: http://localhost:8080/_/#!/app-link-insecure/localhost:8080/

You may now open the provided url in your favorite browser on your docker host.

As a bonus, this PR also fixes the --port option value which was ignored before.

ricmoo commented 6 years ago

Ah! This looks good. I will get to this soon.

gquemener commented 6 years ago

I've rebased my branch on master and fixed conflicts.

ricmoo commented 6 years ago

Updated in npm at version 2.0.5.

Thanks again! :)