| 12345678910111213141516171819202122232425262728293031323334 |
- package config
- import "os"
- // Config holds application configuration
- type Config struct {
- Port string
- UploadsDir string
- DBPath string
- }
- // Load loads configuration from environment variables
- func Load() *Config {
- port := os.Getenv("PORT")
- if port == "" {
- port = "8080"
- }
- uploadsDir := os.Getenv("UPLOADS_DIR")
- if uploadsDir == "" {
- uploadsDir = "uploads"
- }
- dbPath := os.Getenv("DB_PATH")
- if dbPath == "" {
- dbPath = "data/bolt.db"
- }
- return &Config{
- Port: port,
- UploadsDir: uploadsDir,
- DBPath: dbPath,
- }
- }
|