Skip to content

Commit 27738f4

Browse files
committed
Feat: Add API Version + Cluster ID to config
1 parent 4d3d855 commit 27738f4

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

persysctl/internal/config/config.go

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ type Config struct {
1919
APIEndpoint string
2020
PrivateKey *rsa.PrivateKey
2121
PublicKeyPEM string
22-
22+
APIVersion string
23+
ClusterID string
2324
Transport string
2425
GRPCEndpoint string
2526
GRPCInsecure bool
@@ -75,6 +76,18 @@ func GetConfig() Config {
7576
log.Printf("WARNING! No api_endpoint found in your config.yaml; defaulting to: %v", cfg.APIEndpoint)
7677
}
7778

79+
cfg.APIVersion = viper.GetString("api_version")
80+
if cfg.APIVersion == "" {
81+
cfg.APIVersion = "v2"
82+
log.Printf("WARNING! No api_version found in your config.yaml; defaulting to: %v", cfg.APIVersion)
83+
}
84+
85+
cfg.ClusterID = viper.GetString("cluster_id")
86+
if cfg.ClusterID == "" {
87+
cfg.ClusterID = "persys-genesis-a"
88+
log.Printf("WARNING! No cluster_id found in your config.yaml; some operations may fail.")
89+
}
90+
7891
cfg.Transport = strings.ToLower(viper.GetString("transport"))
7992
if cfg.Transport == "" {
8093
cfg.Transport = "grpc"

0 commit comments

Comments
 (0)