Files
panelhosting/internal/config/config.go
T

29 lines
380 B
Go

package config
import (
"fmt"
"os"
)
type Config struct {
DatabaseURL string
HTTPPort string
}
func Load() (*Config, error) {
url := os.Getenv("DATABASE_URL")
if url == "" {
return nil, fmt.Errorf("DATABASE_URL is required")
}
port := os.Getenv("HTTP_PORT")
if port == "" {
port = "8000"
}
return &Config{
DatabaseURL: url,
HTTPPort: port,
}, nil
}