StoreConfig always initializes the account if it is missing
This commit is contained in:
parent
0f0ba099c9
commit
e4bb506ace
1 changed files with 15 additions and 1 deletions
|
@ -85,8 +85,13 @@ func Run(kv *staert.KvSource, traefikConfiguration *cmd.TraefikConfiguration) fu
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
accountInitialized, err := keyExists(kv, traefikConfiguration.GlobalConfiguration.ACME.Storage)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
// Check to see if ACME account object is already in kv store
|
// Check to see if ACME account object is already in kv store
|
||||||
if traefikConfiguration.GlobalConfiguration.ACME.OverrideCertificates {
|
if traefikConfiguration.GlobalConfiguration.ACME.OverrideCertificates || !accountInitialized {
|
||||||
|
|
||||||
// Store the ACME Account into the KV Store
|
// Store the ACME Account into the KV Store
|
||||||
// Certificates in KV Store will be overridden
|
// Certificates in KV Store will be overridden
|
||||||
|
@ -114,6 +119,15 @@ func Run(kv *staert.KvSource, traefikConfiguration *cmd.TraefikConfiguration) fu
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func keyExists(source *staert.KvSource, key string) (bool, error) {
|
||||||
|
list, err := source.List(key, nil)
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return len(list) > 0, nil
|
||||||
|
}
|
||||||
|
|
||||||
// migrateACMEData allows migrating data from acme.json file to KV store in function of the file format
|
// migrateACMEData allows migrating data from acme.json file to KV store in function of the file format
|
||||||
func migrateACMEData(fileName string) (*acme.Account, error) {
|
func migrateACMEData(fileName string) (*acme.Account, error) {
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue