Skip to content

Commit

Permalink
chore: add flag to print version number
Browse files Browse the repository at this point in the history
  • Loading branch information
iczc committed Sep 16, 2021
1 parent 0d85697 commit b9135a3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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**
Expand Down Expand Up @@ -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
Expand Down
10 changes: 9 additions & 1 deletion cmd/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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}

Expand All @@ -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() {
Expand Down

0 comments on commit b9135a3

Please sign in to comment.