Add warning log for unknown config fields

Add error log for failure to parse toml

Signed-off-by: Derek McGowan <derek@mcg.dev>
This commit is contained in:
Derek McGowan
2023-09-24 16:59:27 -07:00
parent b5615caf11
commit 650148313c
5 changed files with 48 additions and 14 deletions

View File

@@ -91,7 +91,7 @@ var configCommand = cli.Command{
Usage: "See the output of the final main config with imported in subconfig files",
Action: func(context *cli.Context) error {
config := defaultConfig()
if err := srvconfig.LoadConfig(context.GlobalString("config"), config); err != nil && !os.IsNotExist(err) {
if err := srvconfig.LoadConfig(gocontext.Background(), context.GlobalString("config"), config); err != nil && !os.IsNotExist(err) {
return err
}

View File

@@ -121,7 +121,7 @@ can be used and modified as necessary as a custom configuration.`
configPath := context.GlobalString("config")
_, err := os.Stat(configPath)
if !os.IsNotExist(err) || context.GlobalIsSet("config") {
if err := srvconfig.LoadConfig(configPath, config); err != nil {
if err := srvconfig.LoadConfig(ctx, configPath, config); err != nil {
return err
}
}