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",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"name": {
|
"name": {
|
||||||
"description": "The name of the cluster.",
|
"description": "The name of the cluster."
|
||||||
"kind": {
|
|
||||||
"type": "string",
|
|
||||||
"enum": ["influxdb", "prometheus", "cc-metric-store", "cc-metric-store-internal", "test"]
|
|
||||||
},
|
|
||||||
"url": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
},
|
||||||
"subClusters" {
|
"subClusters" {
|
||||||
"description": "The array of overrides per subcluster.",
|
"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 {
|
type ClusterConfig struct {
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
SubClusters []SubClusterConfig `json:"subClusters"`
|
JobListMetrics []string `json:"jobListMetrics"`
|
||||||
|
JobViewPlotMetrics []string `json:"jobViewPlotMetrics"`
|
||||||
|
JobViewTableMetrics []string `json:"jobViewTableMetrics"`
|
||||||
|
SubClusters []SubClusterConfig `json:"subClusters"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type SubClusterConfig struct {
|
type SubClusterConfig struct {
|
||||||
@@ -74,7 +77,7 @@ type PlotConfiguration struct {
|
|||||||
|
|
||||||
var initOnce sync.Once
|
var initOnce sync.Once
|
||||||
|
|
||||||
var Keys = WebConfig{
|
var UIDefaults = WebConfig{
|
||||||
JobList: JobListConfig{
|
JobList: JobListConfig{
|
||||||
UsePaging: false,
|
UsePaging: false,
|
||||||
ShowFootprint: true,
|
ShowFootprint: true,
|
||||||
@@ -119,7 +122,7 @@ func Init(rawConfig json.RawMessage, disableArchive bool) error {
|
|||||||
|
|
||||||
initOnce.Do(func() {
|
initOnce.Do(func() {
|
||||||
config.Validate(configSchema, rawConfig)
|
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")
|
cclog.Warn("Error while unmarshaling raw config json")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user