Skip to content

Modern Docker Management, Designed for Everyone

refactor(cli): remove viper config loading and use raw yaml marshalling

Kyle Mendelle4c1c0a335af
diff --git a/.custom-gcl.yml b/.custom-gcl.yml
deleted file mode 100644
index 4609e8603..000000000
--- a/.custom-gcl.yml
+++ /dev/null
@@ -1,7 +0,0 @@
-version: v2.14.0
-name: golangci-lint-custom
-destination: ./.bin
-
-plugins:
- - module: go.ofkm.dev/shimbad
- version: v0.2.0
diff --git a/backend/.custom-gcl.yml b/backend/.custom-gcl.yml
deleted file mode 120000
index 982ca0f91..000000000
--- a/backend/.custom-gcl.yml
+++ /dev/null
@@ -1 +0,0 @@
-../.custom-gcl.yml
\ No newline at end of file
diff --git a/backend/pkg/libarcane/startup/runtime_identity_linux.go b/backend/pkg/libarcane/startup/runtime_identity_linux.go
index e1c5b50aa..db1f3e784 100644
--- a/backend/pkg/libarcane/startup/runtime_identity_linux.go
+++ b/backend/pkg/libarcane/startup/runtime_identity_linux.go
@@ -35,8 +35,8 @@ func reexecWithRuntimeIdentityInternal(ctx context.Context, req runtimeIdentityR
},
}
- if err := cmd.Start(); err != nil {
- return fmt.Errorf("start runtime identity child: %w", err)
+ if startErr := cmd.Start(); startErr != nil {
+ return fmt.Errorf("start runtime identity child: %w", startErr)
}
sigCh := make(chan os.Signal, 2)
@@ -53,14 +53,14 @@ func reexecWithRuntimeIdentityInternal(ctx context.Context, req runtimeIdentityR
if cmd.Process != nil {
_ = cmd.Process.Signal(sig)
}
- case err := <-done:
+ case waitErr := <-done:
signal.Stop(sigCh)
- if err == nil {
+ if waitErr == nil {
os.Exit(0)
}
- if exitErr, ok := errors.AsType[*exec.ExitError](err); ok {
- if status, ok := exitErr.Sys().(syscall.WaitStatus); ok {
+ if exitErr, ok := errors.AsType[*exec.ExitError](waitErr); ok {
+ if status, hasStatus := exitErr.Sys().(syscall.WaitStatus); hasStatus {
if status.Signaled() {
os.Exit(128 + int(status.Signal()))
}
@@ -69,7 +69,7 @@ func reexecWithRuntimeIdentityInternal(ctx context.Context, req runtimeIdentityR
os.Exit(exitErr.ExitCode())
}
- return fmt.Errorf("wait for runtime identity child: %w", err)
+ return fmt.Errorf("wait for runtime identity child: %w", waitErr)
}
}
}
diff --git a/cli/.custom-gcl.yml b/cli/.custom-gcl.yml
deleted file mode 120000
index 982ca0f91..000000000
--- a/cli/.custom-gcl.yml
+++ /dev/null
@@ -1 +0,0 @@
-../.custom-gcl.yml
\ No newline at end of file
diff --git a/cli/go.mod b/cli/go.mod
index 2e793a22e..23ee220d1 100644
--- a/cli/go.mod
+++ b/cli/go.mod
@@ -12,16 +12,15 @@ require (
charm.land/log/v2 v2.0.1
github.com/charmbracelet/x/term v0.2.2
github.com/getarcaneapp/arcane/types/v2 v2.14.0
- github.com/go-viper/mapstructure/v2 v2.5.0
github.com/mattn/go-runewidth v0.0.30
github.com/samber/hot v0.13.1
github.com/spf13/cobra v1.10.2
github.com/spf13/pflag v1.0.10
- github.com/spf13/viper v1.21.0
github.com/stretchr/testify v1.12.1
go.getarcane.app/acfs v0.6.2
go.getarcane.app/kit v0.3.2
go.getarcane.app/sys/bytes v0.2.1
+ go.yaml.in/yaml/v4 v4.0.0-rc.6
)
require (
@@ -46,10 +45,10 @@ require (
github.com/docker/go-connections v0.8.1 // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/felixge/httpsnoop v1.1.0 // indirect
- github.com/fsnotify/fsnotify v1.10.1 // indirect
github.com/go-logfmt/logfmt v0.6.1 // indirect
github.com/go-logr/logr v1.4.4 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
+ github.com/go-viper/mapstructure/v2 v2.5.0 // indirect
github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/lucasb-eyer/go-colorful v1.4.1 // indirect
@@ -65,20 +64,14 @@ require (
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.1.1 // indirect
- github.com/pelletier/go-toml/v2 v2.4.3 // indirect
github.com/prometheus/client_golang v1.24.1 // indirect
github.com/prometheus/client_model v0.6.3 // indirect
github.com/prometheus/common v0.71.0 // indirect
github.com/prometheus/procfs v0.22.0 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
- github.com/rogpeppe/go-internal v1.15.0 // indirect
- github.com/sagikazarmark/locafero v0.12.0 // indirect
github.com/sahilm/fuzzy v0.1.3 // indirect
github.com/samber/go-singleflightx v0.3.2 // indirect
github.com/sirupsen/logrus v1.10.2 // indirect
- github.com/spf13/afero v1.15.0 // indirect
- github.com/spf13/cast v1.10.0 // indirect
- github.com/subosito/gotenv v1.6.0 // indirect
github.com/xhit/go-str2duration/v2 v2.1.0 // indirect
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
go.getarcane.app/builds v0.4.3 // indirect
@@ -88,7 +81,6 @@ require (
go.opentelemetry.io/otel/metric v1.46.0 // indirect
go.opentelemetry.io/otel/trace v1.46.0 // indirect
go.yaml.in/yaml/v3 v3.0.5 // indirect
- go.yaml.in/yaml/v4 v4.0.0-rc.6 // indirect
golang.org/x/exp v0.0.0-20260908205506-85c1c2202aba // indirect
golang.org/x/sync v0.23.0 // indirect
golang.org/x/sys v0.48.0 // indirect
diff --git a/cli/go.sum b/cli/go.sum
index c5899d067..b09d5aa82 100644
--- a/cli/go.sum
+++ b/cli/go.sum
@@ -57,10 +57,6 @@ github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4
github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
github.com/felixge/httpsnoop v1.1.0 h1:3YtUj32ZZkqZtt3sZZsClsymw/QDuVfpNhoA31zeORc=
github.com/felixge/httpsnoop v1.1.0/go.mod h1:Zqxgdd+1Rkcz8euOqdr7lqgCRJztwr5hp9vDSi5UZCE=
-github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8=
-github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0=
-github.com/fsnotify/fsnotify v1.10.1 h1:b0/UzAf9yR5rhf3RPm9gf3ehBPpf0oZKIjtpKrx59Ho=
-github.com/fsnotify/fsnotify v1.10.1/go.mod h1:TLheqan6HD6GBK6PrDWyDPBaEV8LspOxvPSjC+bVfgo=
github.com/go-logfmt/logfmt v0.6.1 h1:4hvbpePJKnIzH1B+8OR/JPbTx37NktoI9LE2QZBBkvE=
github.com/go-logfmt/logfmt v0.6.1/go.mod h1:EV2pOAQoZaT1ZXZbqDl5hrymndi4SY9ED9/z6CO0XAk=
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
@@ -79,10 +75,6 @@ github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
-github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
-github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
-github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
-github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
github.com/lucasb-eyer/go-colorful v1.4.1 h1:1EO+WB73+EH8EVbzlrG3KLAfEypQWVHIBqlTf+2hNss=
@@ -113,8 +105,6 @@ github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8
github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM=
github.com/opencontainers/image-spec v1.1.1 h1:y0fUlFfIZhPF1W537XOLg0/fcx6zcHCJwooC2xJA040=
github.com/opencontainers/image-spec v1.1.1/go.mod h1:qpqAh3Dmcf36wStyyWU+kCeDgrGnAve2nCC8+7h8Q0M=
-github.com/pelletier/go-toml/v2 v2.4.3 h1:GTRvJQutkOSftxIFD5xw9aepkYNuPWmVJpffdDPYVpY=
-github.com/pelletier/go-toml/v2 v2.4.3/go.mod h1:2gIqNv+qfxSVS7cM2xJQKtLSTLUE9V8t9Stt+h56mCY=
github.com/prometheus/client_golang v1.24.1 h1:JnJkREXzWxUdCuPFpIWZiPispT9xVV59uiuyR2bPlnU=
github.com/prometheus/client_golang v1.24.1/go.mod h1:F+oSRECHg4sse5ucfYpYDeIv/hu68Zo0uoHKetWnzcE=
github.com/prometheus/client_model v0.6.3 h1:O0jaTVAYNxTHYInEPFJt5I3+sN8zqBtVMPTB1qyxiEo=
@@ -125,11 +115,7 @@ github.com/prometheus/procfs v0.22.0 h1:6q9+/JL9IKAPbCmBrv9n5O5Ty3NKnciV5X7YGw0o
github.com/prometheus/procfs v0.22.0/go.mod h1:CvmFr/GVhIjIvWJZW3tgkODBQMRIf0EyWMQLHCHab58=
github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
-github.com/rogpeppe/go-internal v1.15.0 h1:D0RCU5rMAp+SpgkiNdrjfJ+LX4J1M32V2NeCY7EJ6hc=
-github.com/rogpeppe/go-internal v1.15.0/go.mod h1:DrUVZyrJU+txYW5/1kwtXQSMFio52ZOxX7yM1VHvnxs=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
-github.com/sagikazarmark/locafero v0.12.0 h1:/NQhBAkUb4+fH1jivKHWusDYFjMOOKU88eegjfxfHb4=
-github.com/sagikazarmark/locafero v0.12.0/go.mod h1:sZh36u/YSZ918v0Io+U9ogLYQJ9tLLBmM4eneO6WwsI=
github.com/sahilm/fuzzy v0.1.3 h1:juByESSS32nVD81vr6tHmKmA/8zde7gE+x5CLxrzXPU=
github.com/sahilm/fuzzy v0.1.3/go.mod h1:au6//VbVSqu6DFrkL2CfjlJ5iURpNCPeE+1GwY3XsT8=
github.com/samber/go-singleflightx v0.3.2 h1:jXbUU0fvis8Fdv4HGONboX5WdEZcYLoBEcKiE+ITCyQ=
@@ -138,21 +124,13 @@ github.com/samber/hot v0.13.1 h1:cTIS9spjhKs3k6QfL1N2m7qdAud8Aiw8oXsjxR58dxo=
github.com/samber/hot v0.13.1/go.mod h1:NB9v5U4NfDx7jmlrP+zHuqCuLUsywgAtCH7XOAkOxAg=
github.com/sirupsen/logrus v1.10.2 h1:G2SED73/qrAu6YwbdxOD6peLkCBI3z7L+ykJFTXJBBo=
github.com/sirupsen/logrus v1.10.2/go.mod h1:SLEg8TqYulVKKfIGHldVp2K2aYz2DKSVBq4g/H5bR7Q=
-github.com/spf13/afero v1.15.0 h1:b/YBCLWAJdFWJTN9cLhiXXcD7mzKn9Dm86dNnfyQw1I=
-github.com/spf13/afero v1.15.0/go.mod h1:NC2ByUVxtQs4b3sIUphxK0NioZnmxgyCrfzeuq8lxMg=
-github.com/spf13/cast v1.10.0 h1:h2x0u2shc1QuLHfxi+cTJvs30+ZAHOGRic8uyGTDWxY=
-github.com/spf13/cast v1.10.0/go.mod h1:jNfB8QC9IA6ZuY2ZjDp0KtFO2LZZlg4S/7bzP6qqeHo=
github.com/spf13/cobra v1.10.2 h1:DMTTonx5m65Ic0GOoRY2c16WCbHxOOw6xxezuLaBpcU=
github.com/spf13/cobra v1.10.2/go.mod h1:7C1pvHqHw5A4vrJfjNwvOdzYu0Gml16OCs2GRiTUUS4=
github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk=
github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
-github.com/spf13/viper v1.21.0 h1:x5S+0EU27Lbphp4UKm1C+1oQO+rKx36vfCoaVebLFSU=
-github.com/spf13/viper v1.21.0/go.mod h1:P0lhsswPGWD/1lZJ9ny3fYnVqxiegrlNrEmgLjbTCAY=
github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE=
github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg=
-github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8=
-github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU=
github.com/xhit/go-str2duration/v2 v2.1.0 h1:lxklc02Drh6ynqX+DdPyp5pCKLUQpRT8bp8Ydu2Bstc=
github.com/xhit/go-str2duration/v2 v2.1.0/go.mod h1:ohY8p+0f07DiV6Em5LKB0s2YpLtXVyJfNt1+BlmyAsU=
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e h1:JVG44RsyaB9T2KIHavMF/ppJZNG9ZpyihvCd0w101no=
diff --git a/cli/internal/config/config.go b/cli/internal/config/config.go
index ae6523475..99dfd7867 100644
--- a/cli/internal/config/config.go
+++ b/cli/internal/config/config.go
@@ -21,15 +21,16 @@
package config
import (
+ "errors"
"fmt"
"os"
"path/filepath"
"strings"
"time"
- "github.com/go-viper/mapstructure/v2"
"github.com/samber/hot"
- "github.com/spf13/viper"
+ "go.getarcane.app/acfs/atomic"
+ "go.yaml.in/yaml/v4"
"github.com/getarcaneapp/arcane/cli/v2/internal/types"
)
@@ -54,7 +55,7 @@ var configCache = hot.NewHotCache[string, *types.Config](hot.LRU, 4).
WithCopyOnWrite((*types.Config).Clone).
Build()
-func normalizeConfig(cfg *types.Config) *types.Config {
+func normalizeConfigInternal(cfg *types.Config) *types.Config {
if cfg == nil {
return DefaultConfig()
}
@@ -70,7 +71,7 @@ func normalizeConfig(cfg *types.Config) *types.Config {
return normalized
}
-func invalidateCache() {
+func invalidateCacheInternal() {
configCache.Purge()
}
@@ -108,7 +109,7 @@ func ConfigPath() (string, error) {
func SetConfigPath(path string) error {
if strings.TrimSpace(path) == "" {
customConfigPath = ""
- invalidateCache()
+ invalidateCacheInternal()
return nil
}
@@ -128,7 +129,7 @@ func SetConfigPath(path string) error {
}
customConfigPath = absPath
- invalidateCache()
+ invalidateCacheInternal()
return nil
}
@@ -154,27 +155,11 @@ func Load() (*types.Config, error) {
}
return nil, fmt.Errorf("failed to read config file: %w", err)
}
- _ = data
-
- v := viper.New()
- v.SetConfigFile(path)
- v.SetConfigType("yaml")
- v.SetDefault("server_url", "http://localhost:3552")
- v.SetDefault("default_environment", "0")
- v.SetDefault("federated_audience", "")
- v.SetDefault("log_level", "info")
- if readInConfigErr := v.ReadInConfig(); readInConfigErr != nil {
- return nil, fmt.Errorf("failed to parse config file: %w", readInConfigErr)
+ cfg := DefaultConfig()
+ if parseErr := yaml.Unmarshal(data, cfg); parseErr != nil {
+ return nil, fmt.Errorf("failed to parse config file: %w", parseErr)
}
-
- var cfg types.Config
- if unmarshalErr := v.Unmarshal(&cfg, func(dc *mapstructure.DecoderConfig) {
- dc.TagName = "mapstructure"
- dc.WeaklyTypedInput = true
- }); unmarshalErr != nil {
- return nil, fmt.Errorf("failed to unmarshal config: %w", unmarshalErr)
- }
- normalized := normalizeConfig(&cfg)
+ normalized := normalizeConfigInternal(cfg)
configCache.Set(path, normalized)
@@ -190,55 +175,18 @@ func Save(c *types.Config) error {
return err
}
- // Ensure the config directory exists
- dir := filepath.Dir(path)
- if mkdirAllErr := os.MkdirAll(dir, 0o700); mkdirAllErr != nil {
- return fmt.Errorf("failed to create config directory: %w", mkdirAllErr)
- }
-
- cfg := normalizeConfig(c)
- v := viper.New()
- v.SetConfigType("yaml")
- v.Set("server_url", cfg.ServerURL)
- if cfg.APIKey != "" {
- v.Set("api_key", cfg.APIKey)
- }
- if cfg.JWTToken != "" {
- v.Set("jwt_token", cfg.JWTToken)
- }
- if cfg.RefreshToken != "" {
- v.Set("refresh_token", cfg.RefreshToken)
- }
- if cfg.DefaultEnvironment != "" {
- v.Set("default_environment", cfg.DefaultEnvironment)
- }
- if cfg.FederatedAudience != "" {
- v.Set("federated_audience", cfg.FederatedAudience)
- }
- if cfg.LogLevel != "" {
- v.Set("log_level", cfg.LogLevel)
- }
- if cfg.CLIUpdateChannel != "" {
- v.Set("cli_update_channel", cfg.CLIUpdateChannel)
- }
-
- // Canonical pagination structure.
- if cfg.Pagination.Default.Limit > 0 {
- v.Set("pagination.default.limit", cfg.Pagination.Default.Limit)
- }
- for resource, rc := range cfg.Pagination.Resources {
- resource = types.NormalizePaginatedResource(resource)
- if resource == "" || rc.Limit <= 0 {
- continue
+ cfg := normalizeConfigInternal(c)
+ cfg.Pagination.Default.Limit = max(0, cfg.Pagination.Default.Limit)
+ resources := cfg.Pagination.Resources
+ cfg.Pagination.Resources = make(map[string]types.PaginationResourceConfig, len(resources))
+ for resource, rc := range resources {
+ if rc.Limit > 0 {
+ cfg.SetResourceLimit(resource, rc.Limit)
}
- v.Set(fmt.Sprintf("pagination.resources.%s.limit", resource), rc.Limit)
}
- if writeConfigAsErr := v.WriteConfigAs(path); writeConfigAsErr != nil {
- return fmt.Errorf("failed to write config file: %w", writeConfigAsErr)
- }
- if chmodErr := os.Chmod(path, 0o600); chmodErr != nil {
- return fmt.Errorf("failed to set config permissions: %w", chmodErr)
+ if writeErr := writeConfigInternal(path, cfg, false); writeErr != nil {
+ return writeErr
}
configCache.Set(path, cfg)
@@ -246,8 +194,8 @@ func Save(c *types.Config) error {
return nil
}
-// InitDefaultFile creates a default config file with all known keys if one does
-// not already exist. It returns true when a file is created, or false when an
+// InitDefaultFile creates a default config file with credential placeholders.
+// It returns true when a file is created, or false when an
// existing file is left unchanged.
func InitDefaultFile() (bool, error) {
path, err := ConfigPath()
@@ -268,37 +216,67 @@ func InitDefaultFile() (bool, error) {
return false, fmt.Errorf("failed to stat config path: %w", err)
}
- dir := filepath.Dir(path)
- if mkdirAllErr := os.MkdirAll(dir, 0o700); mkdirAllErr != nil {
- return false, fmt.Errorf("failed to create config directory: %w", mkdirAllErr)
- }
-
- v := viper.New()
- v.SetConfigType("yaml")
- v.Set("server_url", "http://localhost:3552")
- v.Set("api_key", "")
- v.Set("jwt_token", "")
- v.Set("refresh_token", "")
- v.Set("default_environment", "0")
- v.Set("federated_audience", "")
- v.Set("log_level", "info")
-
- v.Set("pagination.default.limit", defaultPaginationInitLimit)
+ cfg := DefaultConfig()
+ cfg.SetDefaultLimit(defaultPaginationInitLimit)
for _, resource := range types.KnownPaginatedResources {
- v.Set(fmt.Sprintf("pagination.resources.%s.limit", resource), defaultPaginationInitLimit)
+ cfg.SetResourceLimit(resource, defaultPaginationInitLimit)
}
-
- if writeConfigAsErr := v.WriteConfigAs(path); writeConfigAsErr != nil {
- return false, fmt.Errorf("failed to write config file: %w", writeConfigAsErr)
+ var template yaml.Node
+ if encodeErr := template.Encode(cfg); encodeErr != nil {
+ return false, fmt.Errorf("failed to encode config template: %w", encodeErr)
}
- if chmodErr := os.Chmod(path, 0o600); chmodErr != nil {
- return false, fmt.Errorf("failed to set config permissions: %w", chmodErr)
+ // Show empty authentication fields even though normal saves omit them.
+ for _, key := range []string{"api_key", "jwt_token", "refresh_token", "federated_audience"} {
+ template.Content = append(template.Content,
+ &yaml.Node{Kind: yaml.ScalarNode, Tag: "!!str", Value: key},
+ &yaml.Node{Kind: yaml.ScalarNode, Tag: "!!str", Value: ""},
+ )
}
- invalidateCache()
+ if writeErr := writeConfigInternal(path, &template, true); writeErr != nil {
+ if errors.Is(writeErr, os.ErrExist) {
+ return false, nil
+ }
+ return false, writeErr
+ }
+
+ invalidateCacheInternal()
return true, nil
}
+func writeConfigInternal(path string, cfg any, exclusive bool) (err error) {
+ data, marshalErr := yaml.Marshal(cfg)
+ if marshalErr != nil {
+ return fmt.Errorf("failed to marshal config: %w", marshalErr)
+ }
+ if mkdirErr := os.MkdirAll(filepath.Dir(path), 0o700); mkdirErr != nil {
+ return fmt.Errorf("failed to create config directory: %w", mkdirErr)
+ }
+ writePath := path
+ if exclusive {
+ stagingDir, tempErr := os.MkdirTemp(filepath.Dir(path), ".arcanecli-*")
+ if tempErr != nil {
+ return fmt.Errorf("failed to create config staging directory: %w", tempErr)
+ }
+ defer func() {
+ if cleanupErr := os.RemoveAll(stagingDir); cleanupErr != nil {
+ err = errors.Join(err, fmt.Errorf("failed to remove config staging directory: %w", cleanupErr))
+ }
+ }()
+ writePath = filepath.Join(stagingDir, configFileName)
+ }
+ if writeErr := atomic.WriteFile(writePath, data, 0o600); writeErr != nil {
+ return fmt.Errorf("failed to write config file: %w", writeErr)
+ }
+ if exclusive {
+ // Linking publishes the complete file without replacing an existing path.
+ if linkErr := os.Link(writePath, path); linkErr != nil {
+ return fmt.Errorf("failed to create config file: %w", linkErr)
+ }
+ }
+ return nil
+}
+
// BackupFile moves the active config file to a .bak path and removes the
// original file from its previous location. If no config file exists, it
// returns moved=false and no error.
@@ -337,6 +315,6 @@ func BackupFile() (backupPath string, moved bool, err error) {
return "", false, fmt.Errorf("failed to move config to backup: %w", backupConfigErr)
}
- invalidateCache()
+ invalidateCacheInternal()
return backupPath, true, nil
}
diff --git a/cli/internal/config/config_test.go b/cli/internal/config/config_test.go
index 52275e611..5bb10bc23 100644
--- a/cli/internal/config/config_test.go
+++ b/cli/internal/config/config_test.go
@@ -7,9 +7,12 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
+ "go.yaml.in/yaml/v4"
+
+ "github.com/getarcaneapp/arcane/cli/v2/internal/types"
)
-func setTempConfigPath(t *testing.T) string {
+func setTempConfigPathInternal(t *testing.T) string {
t.Helper()
path := filepath.Join(t.TempDir(), "arcanecli.yml")
@@ -30,7 +33,7 @@ func setTempConfigPath(t *testing.T) string {
}
func TestLoadReturnsDefaultsWhenFileMissing(t *testing.T) {
- path := setTempConfigPath(t)
+ path := setTempConfigPathInternal(t)
{
_, err := os.Stat(path)
require.True(t, os.IsNotExist(err),
@@ -63,71 +66,119 @@ func TestLoadReturnsDefaultsWhenFileMissing(t *testing.T) {
}
func TestSaveAndLoadRoundTripPagination(t *testing.T) {
- path := setTempConfigPath(t)
-
- cfg := DefaultConfig()
- cfg.APIKey = "k_test"
- cfg.CLIUpdateChannel = "next"
- cfg.SetDefaultLimit(42)
- cfg.SetResourceLimit("images", 17)
- cfg.SetResourceLimit("Containers", 9)
- {
-
- err := Save(cfg)
- require.NoError(t, err,
- "Save() failed: %v", err)
- }
-
- raw, err := os.ReadFile(path)
-
- require.NoError(t, err,
- "failed to read saved config: %v", err)
-
- text := string(raw)
-
- require.Contains(t, text, "pagination:",
- "expected saved YAML to include pagination block:\n%s", text)
-
- require.Contains(t, text, "cli_update_channel: next",
- "expected saved YAML to include cli_update_channel key:\n%s", text)
-
- info, err := os.Stat(path)
-
- require.NoError(t, err,
- "failed to stat config file: %v", err)
- {
-
- got := info.Mode().Perm()
- require.Equal(t, os.FileMode(0o600), got,
- "config file permissions=%#o, want %#o", got, 0o600)
- }
-
- loaded, err := Load()
-
- require.NoError(t, err,
- "Load() failed: %v", err)
-
- require.Equal(t, 42, loaded.Pagination.Default.Limit,
- "default limit mismatch: pagination=%d, want 42", loaded.Pagination.Default.Limit)
- {
-
- got := loaded.LimitFor("images")
- require.Equal(t, 17, got,
- "images limit=%d, want 17", got)
- }
- {
-
- got := loaded.LimitFor("containers")
- require.Equal(t, 9, got,
- "containers limit=%d, want 9", got)
+ for _, filename := range []string{"arcanecli.yml", "custom.json", "config"} {
+ t.Run(filename, func(t *testing.T) {
+ path := filepath.Join(filepath.Dir(setTempConfigPathInternal(t)), "nested", filename)
+ require.NoError(t, SetConfigPath(path))
+
+ cfg := DefaultConfig()
+ cfg.APIKey = "k_test"
+ cfg.JWTToken = "jwt_test"
+ cfg.RefreshToken = "refresh_test"
+ cfg.FederatedAudience = "audience_test"
+ cfg.CLIUpdateChannel = "next"
+ cfg.SetDefaultLimit(42)
+ cfg.SetResourceLimit("images", 17)
+ cfg.SetResourceLimit("Containers", 9)
+ cfg.Pagination.Resources["GitOps"] = types.PaginationResourceConfig{Limit: 8}
+ cfg.Pagination.Resources[" "] = types.PaginationResourceConfig{Limit: 5}
+ cfg.Pagination.Resources["volumes"] = types.PaginationResourceConfig{Limit: -1}
+ {
+
+ err := Save(cfg)
+ require.NoError(t, err,
+ "Save() failed: %v", err)
+ }
+
+ raw, err := os.ReadFile(path)
+
+ require.NoError(t, err,
+ "failed to read saved config: %v", err)
+
+ text := string(raw)
+ require.NotContains(t, text, "volumes:")
+ require.Contains(t, text, "gitops-syncs:")
+ require.NotContains(t, text, "GitOps:")
+
+ require.Contains(t, text, "pagination:",
+ "expected saved YAML to include pagination block:\n%s", text)
+
+ require.Contains(t, text, "cli_update_channel: next",
+ "expected saved YAML to include cli_update_channel key:\n%s", text)
+
+ info, err := os.Stat(path)
+
+ require.NoError(t, err,
+ "failed to stat config file: %v", err)
+ {
+
+ got := info.Mode().Perm()
+ require.Equal(t, os.FileMode(0o600), got,
+ "config file permissions=%#o, want %#o", got, 0o600)
+ }
+
+ dirInfo, dirErr := os.Stat(filepath.Dir(path))
+ require.NoError(t, dirErr)
+ require.Equal(t, os.FileMode(0o700), dirInfo.Mode().Perm())
+ cfg.APIKey = "changed after save"
+ cfg.SetResourceLimit("images", 99)
+ cached, cacheErr := Load()
+ require.NoError(t, cacheErr)
+ require.Equal(t, "k_test", cached.APIKey)
+ require.Equal(t, 17, cached.LimitFor("images"))
+ require.Equal(t, 8, cached.LimitFor("gitops-syncs"))
+ require.NotContains(t, cached.Pagination.Resources, "GitOps")
+ require.NotContains(t, cached.Pagination.Resources, "volumes")
+ invalidateCacheInternal()
+ loaded, err := Load()
+
+ require.NoError(t, err,
+ "Load() failed: %v", err)
+
+ require.Equal(t, 42, loaded.Pagination.Default.Limit,
+ "default limit mismatch: pagination=%d, want 42", loaded.Pagination.Default.Limit)
+ {
+
+ got := loaded.LimitFor("images")
+ require.Equal(t, 17, got,
+ "images limit=%d, want 17", got)
+ }
+ {
+
+ got := loaded.LimitFor("containers")
+ require.Equal(t, 9, got,
+ "containers limit=%d, want 9", got)
+ }
+
+ require.Equal(t, "next", loaded.CLIUpdateChannel,
+ "CLIUpdateChannel=%q, want next", loaded.CLIUpdateChannel)
+ require.Equal(t, "k_test", loaded.APIKey)
+ require.Equal(t, "jwt_test", loaded.JWTToken)
+ require.Equal(t, "refresh_test", loaded.RefreshToken)
+ require.Equal(t, "audience_test", loaded.FederatedAudience)
+ require.Equal(t, 8, loaded.LimitFor("gitops-syncs"))
+ loaded.SetResourceLimit("images", 101)
+ reloaded, reloadErr := Load()
+ require.NoError(t, reloadErr)
+ require.Equal(t, 17, reloaded.LimitFor("images"))
+
+ require.NoError(t, os.Chmod(path, 0o644))
+ require.NoError(t, Save(&types.Config{
+ ServerURL: "https://short.test",
+ Pagination: types.PaginationConfig{Default: types.PaginationResourceConfig{Limit: -1}},
+ }))
+ omittedRaw, omittedErr := os.ReadFile(path)
+ require.NoError(t, omittedErr)
+ require.Equal(t, "server_url: https://short.test\n", string(omittedRaw))
+ securedInfo, securedErr := os.Stat(path)
+ require.NoError(t, securedErr)
+ require.Equal(t, os.FileMode(0o600), securedInfo.Mode().Perm())
+ })
}
-
- require.Equal(t, "next", loaded.CLIUpdateChannel,
- "CLIUpdateChannel=%q, want next", loaded.CLIUpdateChannel)
}
func TestLoadCanonicalPaginationBlock(t *testing.T) {
- path := setTempConfigPath(t)
+ path := setTempConfigPathInternal(t)
content := `
server_url: https://api.arcane.test
api_key: k_123
@@ -173,10 +224,95 @@ pagination:
require.Equal(t, 9, got,
"registries limit=%d, want 9", got)
}
+
+ for _, tc := range []struct {
+ name string
+ content string
+ serverURL string
+ environment string
+ logLevel string
+ limit int
+ resourceLimit int
+ errorText string
+ }{
+ {name: "partial defaults", content: "api_key: partial\n", serverURL: "http://localhost:3552", environment: "0", logLevel: "info"},
+ {name: "empty document", content: "", serverURL: "http://localhost:3552", environment: "0", logLevel: "info"},
+ {name: "null document", content: "null\n", serverURL: "http://localhost:3552", environment: "0", logLevel: "info"},
+ {name: "dotted keys are unknown", content: "pagination.default.limit: 13\n", serverURL: "http://localhost:3552", environment: "0", logLevel: "info"},
+ {name: "keys are case sensitive", content: `SERVER_URL: https://mixed.test
+Default_Environment: 2
+LOG_LEVEL: debug
+PAGINATION:
+ DEFAULT:
+ LIMIT: 13
+ RESOURCES:
+ NETWORKS:
+ LIMIT: 4
+`, serverURL: "http://localhost:3552", environment: "0", logLevel: "info"},
+ {name: "numeric environment and unknown keys", content: `default_environment: 2
+pagination:
+ default:
+ limit: 13
+ unknown_key: ignored
+ resources:
+ networks:
+ limit: 4
+unknown_key: ignored
+`, serverURL: "http://localhost:3552", environment: "2", logLevel: "info", limit: 13, resourceLimit: 4},
+ {name: "explicit empty and zero", content: `server_url: ""
+default_environment: ""
+log_level: ""
+pagination:
+ default:
+ limit: 0
+ resources:
+ networks:
+ limit: 0
+`},
+ {name: "null defaults", content: `server_url: null
+default_environment: null
+log_level: null
+pagination:
+ default:
+ limit: null
+ resources:
+ networks:
+ limit: null
+`, serverURL: "http://localhost:3552", environment: "0", logLevel: "info"},
+ {name: "malformed yaml", content: "pagination: [\n", errorText: "failed to parse config file"},
+ {name: "invalid limit", content: "pagination:\n default:\n limit: invalid\n", errorText: "failed to parse config file"},
+ {name: "quoted limit", content: "pagination:\n default:\n limit: \"13\"\n", errorText: "failed to parse config file"},
+ } {
+ t.Run(tc.name, func(t *testing.T) {
+ fixturePath := setTempConfigPathInternal(t)
+ require.NoError(t, os.WriteFile(fixturePath, []byte(tc.content), 0o600))
+ loaded, loadErr := Load()
+ if tc.errorText != "" {
+ require.ErrorContains(t, loadErr, tc.errorText)
+ require.Nil(t, loaded)
+ require.NoError(t, os.WriteFile(fixturePath, []byte("server_url: https://recovered.test\n"), 0o600))
+ recovered, recoveryErr := Load()
+ require.NoError(t, recoveryErr)
+ require.Equal(t, "https://recovered.test", recovered.ServerURL)
+ return
+ }
+ require.NoError(t, loadErr)
+ require.Equal(t, tc.serverURL, loaded.ServerURL)
+ require.Equal(t, tc.environment, loaded.DefaultEnvironment)
+ require.Equal(t, tc.logLevel, loaded.LogLevel)
+ require.Equal(t, tc.limit, loaded.Pagination.Default.Limit)
+ require.Equal(t, tc.resourceLimit, loaded.LimitFor("networks"))
+ require.NotNil(t, loaded.Pagination.Resources)
+ })
+ }
}
func TestInitDefaultFileCreatesTemplate(t *testing.T) {
- path := setTempConfigPath(t)
+ path := setTempConfigPathInternal(t)
+ path = filepath.Join(filepath.Dir(path), "template.json")
+ require.NoError(t, SetConfigPath(path))
+ _, initialErr := Load()
+ require.NoError(t, initialErr)
created, err := InitDefaultFile()
@@ -192,6 +328,19 @@ func TestInitDefaultFileCreatesTemplate(t *testing.T) {
"failed to read config file: %v", err)
text := string(raw)
+ var values map[string]any
+ require.NoError(t, yaml.Unmarshal(raw, &values))
+ for _, key := range []string{"api_key", "jwt_token", "refresh_token", "federated_audience"} {
+ require.Contains(t, values, key)
+ require.Empty(t, values[key])
+ }
+ info, statErr := os.Stat(path)
+ require.NoError(t, statErr)
+ require.Equal(t, os.FileMode(0o600), info.Mode().Perm())
+ entries, readDirErr := os.ReadDir(filepath.Dir(path))
+ require.NoError(t, readDirErr)
+ require.Len(t, entries, 1)
+ require.Equal(t, filepath.Base(path), entries[0].Name())
requiredKeys := []string{
"server_url:",
@@ -229,7 +378,7 @@ func TestInitDefaultFileCreatesTemplate(t *testing.T) {
}
func TestInitDefaultFileDoesNotOverwriteExistingFile(t *testing.T) {
- path := setTempConfigPath(t)
+ path := setTempConfigPathInternal(t)
original := "server_url: https://custom.arcane.example\napi_key: custom\n"
{
err := os.WriteFile(path, []byte(original), 0o600)
@@ -244,6 +393,11 @@ func TestInitDefaultFileDoesNotOverwriteExistingFile(t *testing.T) {
require.False(t, created,
"InitDefaultFile() created = true, want false")
+ // The writer must also refuse an existing file after the initial path check.
+ require.ErrorIs(t, writeConfigInternal(path, DefaultConfig(), true), os.ErrExist)
+ entries, readDirErr := os.ReadDir(filepath.Dir(path))
+ require.NoError(t, readDirErr)
+ require.Len(t, entries, 1)
raw, err := os.ReadFile(path)
@@ -255,7 +409,7 @@ func TestInitDefaultFileDoesNotOverwriteExistingFile(t *testing.T) {
}
func TestBackupFileMovesConfig(t *testing.T) {
- path := setTempConfigPath(t)
+ path := setTempConfigPathInternal(t)
original := "server_url: https://backup.arcane.example\napi_key: abc123\n"
{
err := os.WriteFile(path, []byte(original), 0o600)
@@ -290,7 +444,7 @@ func TestBackupFileMovesConfig(t *testing.T) {
}
func TestBackupFileNoConfig(t *testing.T) {
- path := setTempConfigPath(t)
+ path := setTempConfigPathInternal(t)
{
_, err := os.Stat(path)
require.True(t, os.IsNotExist(err),
@@ -310,7 +464,7 @@ func TestBackupFileNoConfig(t *testing.T) {
}
func TestBackupFileRotatesExistingBak(t *testing.T) {
- path := setTempConfigPath(t)
+ path := setTempConfigPathInternal(t)
backupPath := path + ".bak"
{
diff --git a/cli/internal/types/config.go b/cli/internal/types/config.go
index 9513d1d2c..7685c637f 100644
--- a/cli/internal/types/config.go
+++ b/cli/internal/types/config.go
@@ -9,15 +9,15 @@ import (
// PaginationResourceConfig defines pagination options for a specific resource.
type PaginationResourceConfig struct {
// Limit is the default page size for list commands for this resource.
- Limit int `yaml:"limit,omitempty" mapstructure:"limit"`
+ Limit int `yaml:"limit,omitempty"`
}
// PaginationConfig contains global and per-resource pagination settings.
type PaginationConfig struct {
// Default applies to paginated resources that do not have explicit per-resource config.
- Default PaginationResourceConfig `yaml:"default,omitempty" mapstructure:"default"`
+ Default PaginationResourceConfig `yaml:"default,omitempty"`
// Resources contains per-resource pagination settings keyed by resource name.
- Resources map[string]PaginationResourceConfig `yaml:"resources,omitempty" mapstructure:"resources"`
+ Resources map[string]PaginationResourceConfig `yaml:"resources,omitempty"`
}
// KnownPaginatedResources is the canonical list of paginated CLI resources.
@@ -38,12 +38,11 @@ var KnownPaginatedResources = []string{
"apikeys",
}
+var paginationResourceReplacer = strings.NewReplacer("_", "", "-", "", " ", "")
+
// NormalizePaginatedResource normalizes resource names and common aliases.
func NormalizePaginatedResource(resource string) string {
- r := strings.ToLower(strings.TrimSpace(resource))
- r = strings.ReplaceAll(r, "_", "")
- r = strings.ReplaceAll(r, "-", "")
- r = strings.ReplaceAll(r, " ", "")
+ r := paginationResourceReplacer.Replace(strings.ToLower(strings.TrimSpace(resource)))
switch r {
case "apikey", "apikeys", "keys", "key":
return "apikeys"
@@ -82,23 +81,23 @@ func NormalizePaginatedResource(resource string) string {
// It is persisted to disk as YAML and loaded on each CLI invocation.
type Config struct {
// ServerURL is the base URL of the Arcane server (e.g., http://localhost:3552)
- ServerURL string `yaml:"server_url" mapstructure:"server_url"`
+ ServerURL string `yaml:"server_url"`
// APIKey is the API key for authentication (sent as X-API-KEY)
- APIKey string `yaml:"api_key,omitempty" mapstructure:"api_key"`
+ APIKey string `yaml:"api_key,omitempty"`
// JWTToken is the JWT access token for authentication (sent as Authorization: Bearer)
- JWTToken string `yaml:"jwt_token,omitempty" mapstructure:"jwt_token"`
+ JWTToken string `yaml:"jwt_token,omitempty"`
// RefreshToken is the refresh token for obtaining new access tokens
- RefreshToken string `yaml:"refresh_token,omitempty" mapstructure:"refresh_token"`
+ RefreshToken string `yaml:"refresh_token,omitempty"`
// DefaultEnvironment is the default environment ID to use
- DefaultEnvironment string `yaml:"default_environment,omitempty" mapstructure:"default_environment"`
+ DefaultEnvironment string `yaml:"default_environment,omitempty"`
// FederatedAudience is the default token audience for `arcane-cli auth federated`
- FederatedAudience string `yaml:"federated_audience,omitempty" mapstructure:"federated_audience"`
+ FederatedAudience string `yaml:"federated_audience,omitempty"`
// LogLevel is the logging level (debug, info, warn, error, fatal, panic)
- LogLevel string `yaml:"log_level,omitempty" mapstructure:"log_level"`
+ LogLevel string `yaml:"log_level,omitempty"`
// CLIUpdateChannel controls which channel self-update uses (stable or next).
- CLIUpdateChannel string `yaml:"cli_update_channel,omitempty" mapstructure:"cli_update_channel"`
+ CLIUpdateChannel string `yaml:"cli_update_channel,omitempty"`
// Pagination contains global and per-resource pagination configuration.
- Pagination PaginationConfig `yaml:"pagination,omitempty" mapstructure:"pagination"`
+ Pagination PaginationConfig `yaml:"pagination,omitempty"`
}
// HasAuth returns true if either an API key or JWT token is configured.
diff --git a/go.work.sum b/go.work.sum
index 08d8099ce..cd55d872e 100644
--- a/go.work.sum
+++ b/go.work.sum
@@ -2393,6 +2393,8 @@ github.com/safchain/ethtool v0.3.0 h1:gimQJpsI6sc1yIqP/y8GYgiXn/NjgvpM0RNoWLVVmP
github.com/safchain/ethtool v0.3.0/go.mod h1:SA9BwrgyAqNo7M+uaL6IYbxpm5wk3L7Mm6ocLW+CJUs=
github.com/safchain/ethtool v0.6.2 h1:O3ZPFAKEUEfbtE6J/feEe2Ft7dIJ2Sy8t4SdMRiIMHY=
github.com/safchain/ethtool v0.6.2/go.mod h1:VS7cn+bP3Px3rIq55xImBiZGHVLNyBh5dqG6dDQy8+I=
+github.com/sagikazarmark/locafero v0.12.0 h1:/NQhBAkUb4+fH1jivKHWusDYFjMOOKU88eegjfxfHb4=
+github.com/sagikazarmark/locafero v0.12.0/go.mod h1:sZh36u/YSZ918v0Io+U9ogLYQJ9tLLBmM4eneO6WwsI=
github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE=
github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ=
github.com/samber/slog-echo/v2 v2.0.0 h1:VLUOug7P/qiEO/uyHIxqGZWnlYczZSUBzInewnvzCck=
@@ -2473,6 +2475,10 @@ github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 h1:+jumHNA0Wrel
github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8/go.mod h1:3n1Cwaq1E1/1lhQhtRK2ts/ZwZEhjcQeJQ1RuC6Q/8U=
github.com/spdx/gordf v0.0.0-20201111095634-7098f93598fb h1:bLo8hvc8XFm9J47r690TUKBzcjSWdJDxmjXJZ+/f92U=
github.com/spdx/gordf v0.0.0-20201111095634-7098f93598fb/go.mod h1:uKWaldnbMnjsSAXRurWqqrdyZen1R7kxl8TkmWk2OyM=
+github.com/spf13/afero v1.15.0 h1:b/YBCLWAJdFWJTN9cLhiXXcD7mzKn9Dm86dNnfyQw1I=
+github.com/spf13/afero v1.15.0/go.mod h1:NC2ByUVxtQs4b3sIUphxK0NioZnmxgyCrfzeuq8lxMg=
+github.com/spf13/cast v1.10.0 h1:h2x0u2shc1QuLHfxi+cTJvs30+ZAHOGRic8uyGTDWxY=
+github.com/spf13/cast v1.10.0/go.mod h1:jNfB8QC9IA6ZuY2ZjDp0KtFO2LZZlg4S/7bzP6qqeHo=
github.com/spf13/cobra v1.5.0/go.mod h1:dWXEIy2H428czQCjInthrTRUg7yKbok+2Qi/yBIJoUM=
github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y=
github.com/spf13/cobra v1.9.1/go.mod h1:nDyEzZ8ogv936Cinf6g1RU9MRY64Ir93oCnqb9wxYW0=
@@ -2480,6 +2486,8 @@ github.com/spf13/cobra v1.10.1/go.mod h1:7SmJGaTHFVBY0jW4NXGluQoLvhqFQM+6XSKD+P4
github.com/spf13/jwalterweatherman v0.0.0-20141219030609-3d60171a6431 h1:XTHrT015sxHyJ5FnQ0AeemSspZWaDq7DoTRW0EVsDCE=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
+github.com/spf13/viper v1.21.0 h1:x5S+0EU27Lbphp4UKm1C+1oQO+rKx36vfCoaVebLFSU=
+github.com/spf13/viper v1.21.0/go.mod h1:P0lhsswPGWD/1lZJ9ny3fYnVqxiegrlNrEmgLjbTCAY=
github.com/spiffe/go-spiffe/v2 v2.6.0 h1:l+DolpxNWYgruGQVV0xsfeya3CsC7m8iBzDnMpsbLuo=
github.com/spiffe/go-spiffe/v2 v2.6.0/go.mod h1:gm2SeUoMZEtpnzPNs2Csc0D/gX33k1xIx7lEzqblHEs=
github.com/spiffe/go-spiffe/v2 v2.7.0 h1:uXe1MflJoHw58wAUvxVlcM7WpKtijWG7I1UidcGh6g4=
diff --git a/types/.custom-gcl.yml b/types/.custom-gcl.yml
deleted file mode 120000
index 982ca0f91..000000000
--- a/types/.custom-gcl.yml
+++ /dev/null
@@ -1 +0,0 @@
-../.custom-gcl.yml
\ No newline at end of file