Files
boc/aamos-admin-upgrade/backend/config/config.go
T
Bernt 6de2455917 v1.2.0: Add Global Markets footer, translated to 9 languages
- Added GLOBAL_MARKETS_TITLE to all translation files
- Updated footer with 12 markets (4 active + 8 upcoming)
- Translated market section to: zh-cn, zh-tw, ja, ko, th, vi, id, ms, hi
- Built and deployed to production
- CloudFront invalidation: I3RTMXVFDJXWLG3SYX208OP1CC
2026-07-08 19:56:03 +00:00

43 lines
895 B
Go

package config
import (
"os"
"strings"
)
type Config struct {
Port string
DBURL string
JWTSecret string
AMOSBaseURL string
CORSOrigins []string
}
func Load() *Config {
return &Config{
Port: getEnv("PORT", "8080"),
DBURL: getEnv("DB_URL", "postgres://postgres:postgres@localhost:5432/aamos?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")),
}
}
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
}