Files
boc/backend/config/config.go
T
Bernt (LandveX AI) 67a69ab073 feat(boc): v1.0 - Complete Business Operations Center
- Go backend API with full CRUD for all modules
- Rust analytics service with parallel processing
- C runtime with POSIX shared memory IPC
- PostgreSQL schema with 30+ tables
- Redis cache, Kafka event streaming
- WebSocket hub, automation engine
- PDF generation, Resend email integration
- JWT auth, multi-tenant
- Docker Compose deployment
- Nginx reverse proxy

Refs: BOC-001
2026-07-12 13:21:10 +00:00

57 lines
1.5 KiB
Go

package config
import (
"os"
"strings"
)
type Config struct {
Port string
DBURL string
JWTSecret string
AMOSBaseURL string
CORSOrigins []string
MigrationsDir string
RustServiceURL string
RedisURL string
KafkaBrokers []string
ResendAPIKey string
FromEmail string
FromName string
}
func Load() *Config {
return &Config{
Port: getEnv("PORT", "9092"),
DBURL: getEnv("DB_URL", "postgres://boc:boc@localhost:5432/boc?sslmode=disable"),
JWTSecret: getEnv("JWT_SECRET", "change-me-in-production"),
AMOSBaseURL: getEnv("AMOS_BASE_URL", "http://localhost:9000"),
CORSOrigins: splitComma(getEnv("CORS_ORIGINS", "http://localhost:3000")),
MigrationsDir: getEnv("MIGRATIONS_DIR", "./db/migrations"),
RustServiceURL: getEnv("RUST_SERVICE_URL", "http://localhost:9093"),
RedisURL: getEnv("REDIS_URL", "redis://localhost:6379"),
KafkaBrokers: splitComma(getEnv("KAFKA_BROKERS", "localhost:9092")),
ResendAPIKey: getEnv("RESEND_API_KEY", ""),
FromEmail: getEnv("FROM_EMAIL", "noreply@landvex.com"),
FromName: getEnv("FROM_NAME", "Landvex BOC"),
}
}
func getEnv(key, fallback string) string {
if v := os.Getenv(key); v != "" {
return v
}
return fallback
}
func splitComma(s string) []string {
parts := strings.Split(s, ",")
out := make([]string, 0, len(parts))
for _, p := range parts {
if t := strings.TrimSpace(p); t != "" {
out = append(out, t)
}
}
return out
}