Use a better method to reload command presets

This commit is contained in:
NI
2020-03-12 21:18:08 +08:00
parent b2210ce2b6
commit 1009cd4284
12 changed files with 206 additions and 374 deletions

View File

@@ -30,14 +30,11 @@ const (
// Redundant creates a group of loaders. They will be executed one by one until
// one of it successfully returned a configuration
func Redundant(loaders ...Loader) Loader {
return func(
log log.Logger,
r Reconfigurator,
) (string, Configuration, error) {
return func(log log.Logger) (string, Configuration, error) {
ll := log.Context("Redundant")
for i := range loaders {
lLoaderName, lCfg, lErr := loaders[i](ll, r)
lLoaderName, lCfg, lErr := loaders[i](ll)
if lErr != nil {
ll.Warning("Unable to load configuration from \"%s\": %s",