diff options
| author | s <[email protected]> | 2025-11-03 21:17:12 -0500 |
|---|---|---|
| committer | s <[email protected]> | 2025-11-03 21:17:12 -0500 |
| commit | f7fcfa623e670dc533bb378912829c73a3593e63 (patch) | |
| tree | 910119ff7293b407affa9ff34706d627d77a3a04 /internal/config/config.go | |
| download | dborg-f7fcfa623e670dc533bb378912829c73a3593e63.tar.gz dborg-f7fcfa623e670dc533bb378912829c73a3593e63.zip | |
hi
Diffstat (limited to 'internal/config/config.go')
| -rw-r--r-- | internal/config/config.go | 36 |
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 +} |
