mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2025-10-02 20:54:32 +02:00
Add incremental configuration
This commit is contained in:
@@ -93,13 +93,7 @@ var configSchema = `
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {
|
||||
"description": "The name of the cluster.",
|
||||
"kind": {
|
||||
"type": "string",
|
||||
"enum": ["influxdb", "prometheus", "cc-metric-store", "cc-metric-store-internal", "test"]
|
||||
},
|
||||
"url": {
|
||||
"type": "string"
|
||||
"description": "The name of the cluster."
|
||||
},
|
||||
"subClusters" {
|
||||
"description": "The array of overrides per subcluster.",
|
||||
|
11
web/web.go
11
web/web.go
@@ -54,8 +54,11 @@ type MetricConfig struct {
|
||||
}
|
||||
|
||||
type ClusterConfig struct {
|
||||
Name string `json:"name"`
|
||||
SubClusters []SubClusterConfig `json:"subClusters"`
|
||||
Name string `json:"name"`
|
||||
JobListMetrics []string `json:"jobListMetrics"`
|
||||
JobViewPlotMetrics []string `json:"jobViewPlotMetrics"`
|
||||
JobViewTableMetrics []string `json:"jobViewTableMetrics"`
|
||||
SubClusters []SubClusterConfig `json:"subClusters"`
|
||||
}
|
||||
|
||||
type SubClusterConfig struct {
|
||||
@@ -74,7 +77,7 @@ type PlotConfiguration struct {
|
||||
|
||||
var initOnce sync.Once
|
||||
|
||||
var Keys = WebConfig{
|
||||
var UIDefaults = WebConfig{
|
||||
JobList: JobListConfig{
|
||||
UsePaging: false,
|
||||
ShowFootprint: true,
|
||||
@@ -119,7 +122,7 @@ func Init(rawConfig json.RawMessage, disableArchive bool) error {
|
||||
|
||||
initOnce.Do(func() {
|
||||
config.Validate(configSchema, rawConfig)
|
||||
if err = json.Unmarshal(rawConfig, &Keys); err != nil {
|
||||
if err = json.Unmarshal(rawConfig, &UIDefaults); err != nil {
|
||||
cclog.Warn("Error while unmarshaling raw config json")
|
||||
return
|
||||
}
|
||||
|
Reference in New Issue
Block a user