Files
Laterna/cmd/internal/config/config.go
T
2025-07-08 22:03:03 +02:00

29 lines
504 B
Go

package config
import (
"encoding/json"
"fmt"
"os"
"github.com/siestaw/laterna/server/cmd/internal/models"
)
func LoadConfig(path string) *models.Config {
file, err := os.ReadFile(path)
if err != nil {
fmt.Println("An error occured while reading the config file:", err)
os.Exit(1)
}
var cfg models.Config
err = json.Unmarshal(file, &cfg)
if err != nil {
fmt.Println("An error occured while parsing the config file:", err)
os.Exit(1)
}
return &cfg
}
var AppConfig *models.Config