Skip to content

Commit b9135a3

Browse files
committed
chore: add flag to print version number
1 parent 0d85697 commit b9135a3

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ The faucet is a web application with the goal of distributing small amounts of E
77

88
* Use private key as sender
99
```bash
10-
docker run -d -p 8080:8080 -e WEB3_PROVIDER="rpc endpoint" -e PRIVATE_KEY="hex private key" chainflag/eth-faucet -httpport 8080
10+
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
1111
```
1212

1313
* Use keystore file as sender
1414
```bash
15-
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
15+
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
1616
```
1717

1818
**Optional Flags**
@@ -65,7 +65,7 @@ _For more details, please refer to the [web readme](https://github.com/chainflag
6565

6666
3. Build binary application to run faucet
6767
```bash
68-
go build -o eth-faucet main.go
68+
go build
6969
export WEB3_PROVIDER=https://ropsten.infura.io
7070
export PRIVATE_KEY=secret
7171
./eth-faucet

cmd/server.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ import (
1515
"github.com/chainflag/eth-faucet/internal/server"
1616
)
1717

18-
const DefaultKeyAuth = "password.txt"
18+
const (
19+
AppVersion = "v1.0.0"
20+
DefaultKeyAuth = "password.txt"
21+
)
1922

2023
var chainIDMap = map[string]int{"mainnet": 1, "ropsten": 3, "rinkeby": 4, "goerli": 5, "kovan": 42}
2124

@@ -26,10 +29,15 @@ var (
2629
payoutFlag = flag.Int("payout", 1, "Number of Ethers to transfer per user request")
2730
proxyCntFlag = flag.Int("proxycount", 0, "Count of reverse proxies in front of the server")
2831
queueCapFlag = flag.Int("queuecap", 100, "Maximum transactions waiting to be sent")
32+
versionFlag = flag.Bool("v", false, "Print version number")
2933
)
3034

3135
func init() {
3236
flag.Parse()
37+
if *versionFlag {
38+
fmt.Println(AppVersion)
39+
os.Exit(0)
40+
}
3341
}
3442

3543
func Execute() {

0 commit comments

Comments
 (0)