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 | 923d6aece0b508c303393b23e8f605d63f46835f (patch) | |
| tree | 65b629c84a20d9cb1f34ba16797dbbe8861a7a91 /internal/config/config.go | |
| download | dborg-923d6aece0b508c303393b23e8f605d63f46835f.tar.gz dborg-923d6aece0b508c303393b23e8f605d63f46835f.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 +} |
