diff options
author | Laria Carolin Chabowski <laria@laria.me> | 2017-10-01 01:07:05 +0200 |
---|---|---|
committer | Laria Carolin Chabowski <laria@laria.me> | 2017-10-03 15:01:38 +0200 |
commit | 7f0771d0a9caf2d3294bfced9e66fac03334d9ba (patch) | |
tree | 37f07c087e36b025503ffbae3a07eebcc3acc649 /storage/cloud/cloudstorage.go | |
parent | c04bbf9c82f216891ba44b8b5b621b8020963086 (diff) | |
download | petrific-7f0771d0a9caf2d3294bfced9e66fac03334d9ba.tar.gz petrific-7f0771d0a9caf2d3294bfced9e66fac03334d9ba.tar.bz2 petrific-7f0771d0a9caf2d3294bfced9e66fac03334d9ba.zip |
Redo storage config
Diffstat (limited to 'storage/cloud/cloudstorage.go')
-rw-r--r-- | storage/cloud/cloudstorage.go | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/storage/cloud/cloudstorage.go b/storage/cloud/cloudstorage.go index 9ae8ee8..261a034 100644 --- a/storage/cloud/cloudstorage.go +++ b/storage/cloud/cloudstorage.go @@ -158,16 +158,20 @@ func cloudStorageCreator(cloudCreator cloudObjectStorageCreator) storage.CreateS return func(conf config.Config, name string) (storage.Storage, error) { var cbos CloudBasedObjectStorage - storageconf := conf.Storage[name] + var storageconf struct { + Prefix string `toml:"prefix,omitempty"` + EncryptFor string `toml:"encrypt_for,omitempty"` + } - storageconf.Get("prefix", &cbos.Prefix) + if err := conf.GetStorageConfData(name, &storageconf); err != nil { + return nil, err + } - encrypt_for := "" - storageconf.Get("encrypt_for", &encrypt_for) + cbos.Prefix = storageconf.Prefix - if encrypt_for != "" { + if storageconf.EncryptFor != "" { cbos.Crypter = gpg.Crypter{ - gpg.Encrypter{Key: encrypt_for}, + gpg.Encrypter{Key: storageconf.EncryptFor}, gpg.Decrypter{}, } } |