diff --git a/internal/config/config.go b/internal/config/config.go new file mode 100644 index 0000000..3f094ba --- /dev/null +++ b/internal/config/config.go @@ -0,0 +1,28 @@ +package config + +import "os" + +// Config holds runtime configuration loaded from environment variables. +type Config struct { + APIPort string + DatabaseURL string + RedisURL string + StellarNetwork string +} + +// Load reads configuration from environment variables. +func Load() *Config { + return &Config{ + APIPort: getEnv("API_PORT", "8080"), + DatabaseURL: getEnv("DATABASE_URL", ""), + RedisURL: getEnv("REDIS_URL", ""), + StellarNetwork: getEnv("STELLAR_NETWORK", "testnet"), + } +} + +func getEnv(key, fallback string) string { + if v := os.Getenv(key); v != "" { + return v + } + return fallback +} \ No newline at end of file