summaryrefslogtreecommitdiffstats
path: root/internal/config/config.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/config/config.go')
-rw-r--r--internal/config/config.go36
1 files changed, 36 insertions, 0 deletions
diff --git a/internal/config/config.go b/internal/config/config.go
new file mode 100644
index 0000000..44ca7e6
--- /dev/null
+++ b/internal/config/config.go
@@ -0,0 +1,36 @@
+package config
+
+import (
+ "os"
+ "time"
+)
+
+type Config struct {
+ APIKey string
+ BaseURL string
+ Timeout time.Duration
+ MaxRetries int
+ UserAgent string
+}
+
+func New() *Config {
+ return &Config{
+ APIKey: os.Getenv("DBORG_API_KEY"),
+ BaseURL: "https://db.org.ai",
+ Timeout: 30 * time.Second,
+ MaxRetries: 3,
+ UserAgent: "dborg-cli/1.0",
+ }
+}
+
+func (c *Config) WithAPIKey(key string) *Config {
+ c.APIKey = key
+ return c
+}
+
+func (c *Config) Validate() error {
+ if c.APIKey == "" {
+ return ErrMissingAPIKey
+ }
+ return nil
+}