2026-08-21 15:58:46 -07:00
|
|
|
package config
|
|
|
|
|
|
2026-08-21 18:07:12 -07:00
|
|
|
import (
|
|
|
|
|
"os"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// TemporalConfig holds Temporal cluster configuration.
|
|
|
|
|
type TemporalConfig struct {
|
|
|
|
|
HostPort string // default: 127.0.0.1:7233
|
|
|
|
|
Namespace string // default: production
|
|
|
|
|
TLSCert string // env: TEMPORAL_TLS_CERT (file path)
|
|
|
|
|
TLSKey string // env: TEMPORAL_TLS_KEY (file path)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// AppConfig holds application configuration.
|
|
|
|
|
type AppConfig struct {
|
|
|
|
|
Temporal TemporalConfig
|
|
|
|
|
AnthropicAPIKey string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// LoadConfig loads application configuration from environment variables.
|
|
|
|
|
func LoadConfig() (AppConfig, error) {
|
|
|
|
|
cfg := AppConfig{
|
|
|
|
|
Temporal: TemporalConfig{
|
|
|
|
|
HostPort: getEnvOrDefault("TEMPORAL_HOSTPORT", "127.0.0.1:7233"),
|
|
|
|
|
Namespace: getEnvOrDefault("TEMPORAL_NAMESPACE", "production"),
|
|
|
|
|
TLSCert: os.Getenv("TEMPORAL_TLS_CERT"),
|
|
|
|
|
TLSKey: os.Getenv("TEMPORAL_TLS_KEY"),
|
|
|
|
|
},
|
|
|
|
|
AnthropicAPIKey: os.Getenv("ANTHROPIC_API_KEY"),
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return cfg, nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func getEnvOrDefault(key, defaultVal string) string {
|
|
|
|
|
if val := os.Getenv(key); val != "" {
|
|
|
|
|
return val
|
|
|
|
|
}
|
|
|
|
|
return defaultVal
|
|
|
|
|
}
|