diff --git a/README.md b/README.md index 8b98fd2..f750480 100644 --- a/README.md +++ b/README.md @@ -7,12 +7,12 @@ The faucet is a web application with the goal of distributing small amounts of E * Use private key as sender ```bash -docker run -d -p 8080:8080 -e WEB3_PROVIDER="rpc endpoint" -e PRIVATE_KEY="hex private key" chainflag/eth-faucet -httpport 8080 +docker run -d -p 8080:8080 -e WEB3_PROVIDER="rpc endpoint" -e PRIVATE_KEY="hex private key" chainflag/eth-faucet:1.0.0 -httpport 8080 ``` * Use keystore file as sender ```bash -docker run -d -p 8080:8080 -e WEB3_PROVIDER="rpc endpoint" -e KEYSTORE="keystore path" -v `pwd`/keystore:/app/keystore -v `pwd`/password.txt:/app/password.txt chainflag/eth-faucet -httpport 8080 +docker run -d -p 8080:8080 -e WEB3_PROVIDER="rpc endpoint" -e KEYSTORE="keystore path" -v `pwd`/keystore:/app/keystore -v `pwd`/password.txt:/app/password.txt chainflag/eth-faucet:1.0.0 -httpport 8080 ``` **Optional Flags** @@ -65,7 +65,7 @@ _For more details, please refer to the [web readme](https://github.com/chainflag 3. Build binary application to run faucet ```bash -go build -o eth-faucet main.go +go build export WEB3_PROVIDER=https://ropsten.infura.io export PRIVATE_KEY=secret ./eth-faucet diff --git a/cmd/server.go b/cmd/server.go index 81ba3bf..491fc76 100644 --- a/cmd/server.go +++ b/cmd/server.go @@ -15,7 +15,10 @@ import ( "github.com/chainflag/eth-faucet/internal/server" ) -const DefaultKeyAuth = "password.txt" +const ( + AppVersion = "v1.0.0" + DefaultKeyAuth = "password.txt" +) var chainIDMap = map[string]int{"mainnet": 1, "ropsten": 3, "rinkeby": 4, "goerli": 5, "kovan": 42} @@ -26,10 +29,15 @@ var ( payoutFlag = flag.Int("payout", 1, "Number of Ethers to transfer per user request") proxyCntFlag = flag.Int("proxycount", 0, "Count of reverse proxies in front of the server") queueCapFlag = flag.Int("queuecap", 100, "Maximum transactions waiting to be sent") + versionFlag = flag.Bool("v", false, "Print version number") ) func init() { flag.Parse() + if *versionFlag { + fmt.Println(AppVersion) + os.Exit(0) + } } func Execute() {