/*
 * Project: Video Sharing Platform
 * Year: 2026
 * Developed by: Molla Samser (Founder of RSK World)
 * 
 * Central configuration management.
 */

package main

import "os"

type Config struct {
	Port         string
	DBURL        string
	RedisURL     string
	IsProduction bool
}

func LoadConfig() Config {
	return Config{
		Port:         getEnv("PORT", "8080"),
		DBURL:        getEnv("DB_URL", "postgres://rsk_user:rsk_pass@localhost:5432/videostream"),
		RedisURL:     getEnv("REDIS_URL", "redis://localhost:6379"),
		IsProduction: getEnv("ENV", "development") == "production",
	}
}

func getEnv(key, fallback string) string {
	if value, ok := os.LookupEnv(key); ok {
		return value
	}
	return fallback
}
