From 78eb6accdde80bff951f02493ea867e128c528e1 Mon Sep 17 00:00:00 2001 From: Guillaume Noale Date: Wed, 25 Jun 2025 15:23:28 +0200 Subject: [PATCH] fix(config): create new scw configuration if not found --- internal/namespaces/config/commands.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/internal/namespaces/config/commands.go b/internal/namespaces/config/commands.go index 748589e4c7..a44f68a575 100644 --- a/internal/namespaces/config/commands.go +++ b/internal/namespaces/config/commands.go @@ -290,7 +290,12 @@ The only allowed attributes are access_key, secret_key, default_organization_id, configPath := core.ExtractConfigPath(ctx) config, err := scw.LoadConfigFromPath(configPath) if err != nil { - return nil, err + if strings.Contains(err.Error(), "no such file or directory") { + fmt.Fprintln(os.Stdout, "config file not found, will attempt to create it") + config = &scw.Config{} + } else { + return nil, err + } } // send_telemetry is the only key that is not in a profile but in the config object directly