package config import ( "git.phc.dm.unipi.it/phc/website/libs/sl" "github.com/joho/godotenv" ) var Slot = sl.NewSlot[Config]() var TestingProductionConfig = Config{ Mode: "production", Host: ":4000", } var TestingDevelopmentConfig = Config{ Mode: "development", Host: ":4000", } type Config struct { Mode string Host string } func Load(l *sl.ServiceLocator) (Config, error) { m, err := godotenv.Read(".env") if err != nil { return Config{}, err } var cfg Config cfg.Mode = "production" if v, ok := m["MODE"]; ok { cfg.Mode = v } cfg.Host = ":4000" if v, ok := m["HOST"]; ok { cfg.Host = v } return cfg, nil }