k3s/pkg/configfilearg/defaultparser.go
Darren Shepherd 21d21ddd4d Add config file support independent of CLI framework
Signed-off-by: Darren Shepherd <darren@rancher.com>
2020-08-29 21:44:13 -07:00

21 lines
475 B
Go

package configfilearg
import (
"github.com/rancher/k3s/pkg/version"
"github.com/sirupsen/logrus"
)
func MustParse(args []string) []string {
parser := &Parser{
After: []string{"server", "agent"},
FlagNames: []string{"--config", "-c"},
EnvName: version.ProgramUpper + "_CONFIG_FILE",
DefaultConfig: "/etc/rancher/" + version.Program + "/config.yaml",
}
result, err := parser.Parse(args)
if err != nil {
logrus.Fatal(err)
}
return result
}