implemented more logging functionality

This commit is contained in:
Gregory Wells
2026-03-24 20:06:06 -04:00
parent d4512e9cce
commit 92f7c0f127
3 changed files with 56 additions and 15 deletions

View File

@@ -3,6 +3,8 @@ package main
import (
"encoding/json"
"os"
"astraltech.xyz/accountmanager/src/logging"
)
type LDAPConfig struct {
@@ -30,12 +32,20 @@ type ServerConfig struct {
}
func loadServerConfig(path string) (*ServerConfig, error) {
logging.Debugf("Loading server config file: %s", path)
file, err := os.ReadFile(path)
if err != nil {
logging.Errorf("Failed to load server config")
logging.Error(err.Error())
return nil, err
}
var cfg ServerConfig
logging.Debugf("Unmarshaling JSON data")
err = json.Unmarshal(file, &cfg)
return &cfg, err
if err != nil {
logging.Error("Failed to read JSON data")
logging.Error(err.Error())
}
return &cfg, nil
}