This repository has been archived on 2026-01-02. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
cover-letter-templater/backend/config/config.go
2025-07-12 14:38:21 +03:00

24 lines
645 B
Go

package config
import "os"
func defaultValue(val string, def string) string {
if val == "" {
return def
}
return val
}
var Env map[string]string
func LoadEnv() {
// Create object where to store used variables
Env = make(map[string]string)
// Get env variables that will be used while server is running
Env["db"] = defaultValue(os.Getenv("POSTGRES_DB"), "postgresql://postgres:postgres@db:5432/cover-letter")
Env["JWT_SECRET"] = defaultValue(os.Getenv("JWT_SECRET"), "just a random string here")
Env["Environment"] = defaultValue(os.Getenv("Environment"), "dev")
Env["CHATGPT_KEY"] = defaultValue(os.Getenv("CHATGPT_KEY"), "")
}