diff --git a/internal/command/common/load_config.go b/internal/command/common/load_config.go index fc16461..0536f32 100644 --- a/internal/command/common/load_config.go +++ b/internal/command/common/load_config.go @@ -4,6 +4,7 @@ import ( "forge.cadoles.com/cadoles/bouncer/internal/config" "github.com/pkg/errors" "github.com/urfave/cli/v2" + "gitlab.com/wpetit/goweb/logger" ) func LoadConfig(ctx *cli.Context) (*config.Config, error) { @@ -15,11 +16,15 @@ func LoadConfig(ctx *cli.Context) (*config.Config, error) { ) if configFile != "" { + logger.Info(ctx.Context, "loading config", logger.F("config", configFile)) + conf, err = config.NewFromFile(configFile) if err != nil { return nil, errors.Wrapf(err, "Could not load config file '%s'", configFile) } } else { + logger.Info(ctx.Context, "using default config") + conf = config.NewDefault() } diff --git a/internal/command/main.go b/internal/command/main.go index ffe9f93..34eff0d 100644 --- a/internal/command/main.go +++ b/internal/command/main.go @@ -9,6 +9,7 @@ import ( "github.com/pkg/errors" "github.com/urfave/cli/v2" + "gitlab.com/wpetit/goweb/logger" ) func Main(buildDate, projectVersion, gitRef, defaultConfigPath string, commands ...*cli.Command) { @@ -29,6 +30,8 @@ func Main(buildDate, projectVersion, gitRef, defaultConfigPath string, commands workdir := ctx.String("workdir") // Switch to new working directory if defined if workdir != "" { + logger.Info(ctx.Context, "changing working directory", logger.F("workdir", workdir)) + if err := os.Chdir(workdir); err != nil { return errors.Wrap(err, "could not change working directory") }