add rancher URL and k8s cluster as config parameters, return them via config endpoint #73

This commit is contained in:
Sonja Happ 2021-06-18 12:02:10 +02:00
parent b99ac9982c
commit d03937e34c
2 changed files with 8 additions and 0 deletions

View file

@ -78,6 +78,8 @@ func InitConfig() error {
testDataPath = flag.String("test-data-path", "", "The path to a test data json file")
groupsPath = flag.String("groups-path", "configuration/groups.yaml", "The path to a YAML file that maps user groups to scenario IDs")
apiUpdateInterval = flag.String("api-update-interval", "10s" /* 10 sec */, "Interval in which API URL is queried for status updates of ICs")
rancherURL = flag.String("rancher-url", "rancher.k8s.eonerc.rwth-aachen.de", "URL of Rancher instance that is used to deploy the backend")
k8sCluster = flag.String("k8s-cluster", "local", "Name of the Kubernetes cluster where the backend is deployed")
)
flag.Parse()
@ -110,6 +112,8 @@ func InitConfig() error {
"groups.path": *groupsPath,
"config.file": *configFile,
"apiupdateinterval": *apiUpdateInterval,
"rancherURL": *rancherURL,
"k8sCluster": *k8sCluster,
}
if *dbClear == true {

View file

@ -53,6 +53,8 @@ type Config struct {
Mode string `json:"mode"`
Contact ConfigContact `json:"contact"`
Authentication ConfigAuthentication `json:"authentication"`
RancherURL string `json:"rancherURL"`
K8sCluster string `json:"k8sCluster"`
}
// getHealth godoc
@ -77,6 +79,8 @@ func getConfig(c *gin.Context) {
resp.SubTitle, _ = cfg.String("sub-title")
resp.Contact.Name, _ = cfg.String("contact.name")
resp.Contact.Mail, _ = cfg.String("contact.mail")
resp.RancherURL, _ = cfg.String("rancherURL")
resp.K8sCluster, _ = cfg.String("k8sCluster")
c.JSON(200, resp)
}