mirror of https://github.com/docker/docs.git
Move the passphraseRetriever to its own file.
Signed-off-by: Hu Keping <hukeping@huawei.com>
This commit is contained in:
parent
dc147d12c4
commit
a80c539ce8
|
|
@ -1,3 +1,16 @@
|
|||
package main
|
||||
|
||||
import ()
|
||||
import (
|
||||
"errors"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func passphraseRetriever(keyName, alias string, createNew bool, attempts int) (passphrase string, giveup bool, err error) {
|
||||
passphrase = mainViper.GetString(strings.ToUpper(alias))
|
||||
|
||||
if passphrase == "" {
|
||||
return "", false, errors.New("expected env variable to not be empty: " + alias)
|
||||
}
|
||||
|
||||
return passphrase, false, nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ package main
|
|||
|
||||
import (
|
||||
"crypto/tls"
|
||||
"errors"
|
||||
_ "expvar"
|
||||
"flag"
|
||||
"fmt"
|
||||
|
|
@ -10,7 +9,6 @@ import (
|
|||
"net"
|
||||
"net/http"
|
||||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"google.golang.org/grpc"
|
||||
|
|
@ -66,16 +64,6 @@ func init() {
|
|||
}
|
||||
}
|
||||
|
||||
func passphraseRetriever(keyName, alias string, createNew bool, attempts int) (passphrase string, giveup bool, err error) {
|
||||
passphrase = mainViper.GetString(strings.ToUpper(alias))
|
||||
|
||||
if passphrase == "" {
|
||||
return "", false, errors.New("expected env variable to not be empty: " + alias)
|
||||
}
|
||||
|
||||
return passphrase, false, nil
|
||||
}
|
||||
|
||||
// Reads the configuration file for storage setup, and sets up the cryptoservice
|
||||
// mapping
|
||||
func setUpCryptoservices(configuration *viper.Viper, allowedBackends []string) (
|
||||
|
|
|
|||
Loading…
Reference in New Issue