mirror of
https://github.com/docker/docs.git
synced 2026-11-05 00:14:17 +03:00
Add rethink init for signer config
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
This commit is contained in:
@@ -82,6 +82,29 @@ func setUpCryptoservices(configuration *viper.Viper, allowedBackends []string) (
|
||||
case notary.MemoryBackend:
|
||||
keyStore = trustmanager.NewKeyMemoryStore(
|
||||
passphrase.ConstantRetriever("memory-db-ignore"))
|
||||
case notary.RethinkDBBackend:
|
||||
var sess *gorethink.Session
|
||||
storeConfig, err := utils.ParseRethinkDBStorage(configuration)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
sess, err = rethinkdb.Connection(storeConfig.CA, storeConfig.Source, storeConfig.AuthKey)
|
||||
if err == nil {
|
||||
defaultAlias := configuration.GetString("storage.default_alias")
|
||||
if defaultAlias == "" {
|
||||
// backwards compatibility - support this environment variable
|
||||
defaultAlias = configuration.GetString(defaultAliasEnv)
|
||||
}
|
||||
|
||||
if defaultAlias == "" {
|
||||
return nil, fmt.Errorf("must provide a default alias for the key DB")
|
||||
}
|
||||
logrus.Debug("Default Alias: ", defaultAlias)
|
||||
s, err := keydbstore.NewKeyRethinkDBStore(passphraseRetriever, defaultAlias, sess)
|
||||
keyStore = s
|
||||
hRegister("DB operational", s.CheckHealth, time.Second*60)
|
||||
}
|
||||
|
||||
case notary.MySQLBackend, notary.SQLiteBackend:
|
||||
storeConfig, err := utils.ParseSQLStorage(configuration)
|
||||
if err != nil {
|
||||
|
||||
@@ -46,14 +46,15 @@ func (g RethinkPrivateKey) DatabaseName() string {
|
||||
}
|
||||
|
||||
// NewKeyRethinkDBStore returns a new KeyRethinkDBStore backed by a RethinkDB database
|
||||
func NewKeyRethinkDBStore(passphraseRetriever passphrase.Retriever, defaultPassAlias string, rethinkSession *gorethink.Session) (*KeyRethinkDBStore, error) {
|
||||
func NewKeyRethinkDBStore(passphraseRetriever passphrase.Retriever, defaultPassAlias string, rethinkSession *gorethink.Session) *KeyRethinkDBStore {
|
||||
cachedKeys := make(map[string]data.PrivateKey)
|
||||
|
||||
return &KeyRethinkDBStore{
|
||||
session: rethinkSession,
|
||||
defaultPassAlias: defaultPassAlias,
|
||||
retriever: passphraseRetriever,
|
||||
cachedKeys: cachedKeys}, nil
|
||||
cachedKeys: cachedKeys,
|
||||
}
|
||||
}
|
||||
|
||||
// Name returns a user friendly name for the storage location
|
||||
|
||||
Reference in New Issue
Block a user