From 39279e4c5fd68af9643e9e1391c48aca5683c570 Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Tue, 17 Dec 2019 18:34:04 +0300 Subject: [PATCH] NSPCC-786 Rename `gen` => `generated` --- README.md | 4 ++-- settings.go | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index cc94508..f080fd0 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/settings.go b/settings.go index c1f20f9..064013b 100644 --- a/settings.go +++ b/settings.go @@ -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")