mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2025-11-01 00:15:05 +01:00
Revert changes to ui config init
This commit is contained in:
15
web/web.go
15
web/web.go
@@ -11,9 +11,7 @@ import (
|
||||
"encoding/json"
|
||||
"html/template"
|
||||
"io/fs"
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/ClusterCockpit/cc-backend/internal/config"
|
||||
@@ -117,18 +115,9 @@ var UIDefaultsMap map[string]any
|
||||
// "status_view_selectedTopProjectCategory": "totalJobs",
|
||||
// }
|
||||
|
||||
func Init(configFilePath string) error {
|
||||
var rawConfig json.RawMessage = nil
|
||||
raw, rerr := os.ReadFile(configFilePath)
|
||||
if rerr != nil {
|
||||
if !os.IsNotExist(rerr) {
|
||||
log.Fatalf("UI-CONFIG ERROR: %v", rerr)
|
||||
}
|
||||
} else {
|
||||
rawConfig = json.RawMessage(raw)
|
||||
}
|
||||
|
||||
func Init(rawConfig json.RawMessage) error {
|
||||
var err error
|
||||
|
||||
if rawConfig != nil {
|
||||
config.Validate(configSchema, rawConfig)
|
||||
if err = json.Unmarshal(rawConfig, &UIDefaults); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user