27 lines
554 B
Go
27 lines
554 B
Go
package config
|
|
|
|
import "os"
|
|
|
|
type Config struct {
|
|
Env string
|
|
DatabaseURL string
|
|
StorageDir string
|
|
SystemAIKey string
|
|
}
|
|
|
|
func Load() Config {
|
|
return Config{
|
|
Env: getenv("APP_ENV", "development"),
|
|
DatabaseURL: getenv("DATABASE_URL", "postgres://agent:agent@localhost:5432/agent?sslmode=disable"),
|
|
StorageDir: getenv("STORAGE_DIR", "./data/files"),
|
|
SystemAIKey: os.Getenv("SYSTEM_AI_KEY"),
|
|
}
|
|
}
|
|
|
|
func getenv(key string, fallback string) string {
|
|
if value := os.Getenv(key); value != "" {
|
|
return value
|
|
}
|
|
return fallback
|
|
}
|