NSPCC-786 Rename gen => generated

This commit is contained in:
Evgeniy Kulikov 2019-12-17 18:34:04 +03:00
parent 798b9c9646
commit 39279e4c5f
No known key found for this signature in database
GPG key ID: BF6AEE0A2A699BF2
2 changed files with 6 additions and 6 deletions

View file

@ -14,7 +14,7 @@ You can download files from NeoFS Network using NeoFS Gateway.
-h, --help show help
-v, --version show version
--key string "gen" to generate key, path to private key file, hex string or wif (default "gen")
--key string "generated" to generate key, path to private key file, hex string or wif (default "generated")
--verbose debug gRPC connections
--request_timeout duration gRPC request timeout (default 5s)
--connect_timeout duration gRPC connect timeout (default 30s)
@ -23,7 +23,7 @@ You can download files from NeoFS Network using NeoFS Gateway.
# Environments:
GW_KEY=stirng - "gen" to generate key, path to private key file, hex string or wif (default "gen")
GW_KEY=stirng - "generated" to generate key, path to private key file, hex string or wif (default "generated")
GW_REQUEST_TIMEOUT=Duration - timeout for request
GW_CONNECT_TIMEOUT=Duration - timeout for connection
GW_LISTEN_ADDRESS=host:port - address to listen connections

View file

@ -20,15 +20,15 @@ import (
type empty int
const (
devNull = empty(0)
generate = "gen"
devNull = empty(0)
generated = "generated"
)
func (empty) Read([]byte) (int, error) { return 0, io.EOF }
func fetchKey(l *zap.Logger, v *viper.Viper) *ecdsa.PrivateKey {
switch val := v.GetString("key"); val {
case generate:
case generated:
key, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader)
if err != nil {
l.Fatal("could not generate private key", zap.Error(err))
@ -67,7 +67,7 @@ func settings() *viper.Viper {
help := flags.BoolP("help", "h", false, "show help")
version := flags.BoolP("version", "v", false, "show version")
flags.String("key", "gen", `"gen" to generate key, path to private key file, hex string or wif`)
flags.String("key", generated, `"`+generated+`" to generate key, path to private key file, hex string or wif`)
flags.Bool("verbose", false, "debug gRPC connections")
flags.Duration("request_timeout", time.Second*5, "gRPC request timeout")