New static configuration loading system.
Co-authored-by: Mathieu Lonjaret <mathieu.lonjaret@gmail.com>
This commit is contained in:
parent
d18edd6f77
commit
8d7eccad5d
165 changed files with 10894 additions and 6076 deletions
22
pkg/cli/loader_flag.go
Normal file
22
pkg/cli/loader_flag.go
Normal file
|
@ -0,0 +1,22 @@
|
|||
package cli
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/containous/traefik/pkg/config/flag"
|
||||
"github.com/containous/traefik/pkg/log"
|
||||
)
|
||||
|
||||
// FlagLoader loads configuration from flags.
|
||||
type FlagLoader struct{}
|
||||
|
||||
// Load loads the command's configuration from flag arguments.
|
||||
func (*FlagLoader) Load(args []string, cmd *Command) (bool, error) {
|
||||
if err := flag.Decode(args, cmd.Configuration); err != nil {
|
||||
return false, fmt.Errorf("failed to decode configuration from flags: %v", err)
|
||||
}
|
||||
|
||||
log.WithoutContext().Println("Configuration loaded from flags.")
|
||||
|
||||
return true, nil
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue