first commit

This commit is contained in:
Adrian Zürcher
2026-01-16 07:51:28 +01:00
commit 4d9e0836e5
15 changed files with 764 additions and 0 deletions

34
env/enviroment.go vendored Normal file
View File

@@ -0,0 +1,34 @@
package env
import (
"os"
"strings"
"github.com/joho/godotenv"
)
const (
Env EnvKey = "ENV"
PhotoDir EnvKey = "PHOTO_DIR"
Host EnvKey = "HOST"
Port EnvKey = "PORT"
IntervalDefault EnvKey = "INTERVAL_DEFAULT"
)
type EnvKey string
func Load(path string) error {
if path == "" {
path = ".env"
}
return godotenv.Load(path)
}
func (key EnvKey) GetValue() string {
return os.Getenv(string(key))
}
func (key EnvKey) GetBoolValue() bool {
value := strings.ToLower(os.Getenv(string(key)))
return value == "true" || value == "1"
}