summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cmd/root.go2
-rw-r--r--internal/config/config.go4
2 files changed, 4 insertions, 2 deletions
diff --git a/cmd/root.go b/cmd/root.go
index 0f29583..cb6a676 100644
--- a/cmd/root.go
+++ b/cmd/root.go
@@ -28,5 +28,5 @@ func Execute() {
}
func init() {
- rootCmd.PersistentFlags().StringP("api-key", "k", os.Getenv("DBORG_API_KEY"), "API key for authentication")
+ rootCmd.PersistentFlags().StringP("api-key", "k", "", "API key for authentication (or set DBORG_API_KEY env var)")
}
diff --git a/internal/config/config.go b/internal/config/config.go
index 44ca7e6..e1da2c2 100644
--- a/internal/config/config.go
+++ b/internal/config/config.go
@@ -24,7 +24,9 @@ func New() *Config {
}
func (c *Config) WithAPIKey(key string) *Config {
- c.APIKey = key
+ if key != "" {
+ c.APIKey = key
+ }
return c
}