-
Notifications
You must be signed in to change notification settings - Fork 1
/
grafana-config.go
71 lines (62 loc) · 1.73 KB
/
grafana-config.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
package config
import (
"github.com/rocket-pool/node-manager-core/config/ids"
)
// Constants
const (
// Tags
grafanaTag string = "grafana/grafana:9.5.18"
)
// Configuration for Grafana
type GrafanaConfig struct {
// The HTTP port to serve on
Port Parameter[uint16]
// The Docker Hub tag for Grafana
ContainerTag Parameter[string]
}
// Generates a new Grafana config
func NewGrafanaConfig() *GrafanaConfig {
return &GrafanaConfig{
Port: Parameter[uint16]{
ParameterCommon: &ParameterCommon{
ID: ids.PortID,
Name: "Grafana Port",
Description: "The port Grafana should run its HTTP server on - this is the port you will connect to in your browser.",
AffectsContainers: []ContainerID{ContainerID_Grafana},
CanBeBlank: false,
OverwriteOnUpgrade: false,
},
Default: map[Network]uint16{
Network_All: 3100,
},
},
ContainerTag: Parameter[string]{
ParameterCommon: &ParameterCommon{
ID: ids.ContainerTagID,
Name: "Grafana Container Tag",
Description: "The tag name of the Grafana container you want to use on Docker Hub.",
AffectsContainers: []ContainerID{ContainerID_Grafana},
CanBeBlank: false,
OverwriteOnUpgrade: true,
},
Default: map[Network]string{
Network_All: grafanaTag,
},
},
}
}
// The title for the config
func (cfg *GrafanaConfig) GetTitle() string {
return "Grafana"
}
// Get the parameters for this config
func (cfg *GrafanaConfig) GetParameters() []IParameter {
return []IParameter{
&cfg.Port,
&cfg.ContainerTag,
}
}
// Get the sections underneath this one
func (cfg *GrafanaConfig) GetSubconfigs() map[string]IConfigSection {
return map[string]IConfigSection{}
}