diff --git a/api/apps.go b/api/apps.go index beba52840..bb980a06a 100644 --- a/api/apps.go +++ b/api/apps.go @@ -80,19 +80,6 @@ func appMiddleware(next http.Handler) http.Handler { } func getApps(w http.ResponseWriter, r *http.Request) { - defaultApps := map[string]util.App{ - string(db.TemplateAnsible): {}, - string(db.TemplateTerraform): {}, - string(db.TemplateTofu): {}, - string(db.TemplateBash): {}, - string(db.TemplatePowerShell): {}, - string(db.TemplatePython): {}, - } - - for k, a := range util.Config.Apps { - defaultApps[k] = a - } - type app struct { ID string `json:"id"` Title string `json:"title"` @@ -104,7 +91,7 @@ func getApps(w http.ResponseWriter, r *http.Request) { apps := make([]app, 0) - for k, a := range defaultApps { + for k, a := range util.Config.Apps { apps = append(apps, app{ ID: k, diff --git a/cli/cmd/root.go b/cli/cmd/root.go index 49091949c..c2614b58e 100644 --- a/cli/cmd/root.go +++ b/cli/cmd/root.go @@ -114,7 +114,7 @@ func createStore(token string) db.Store { panic(err) } - util.CheckDefaultApps() + util.LookupDefaultApps() return store } diff --git a/util/config.go b/util/config.go index 9901460df..ab2c05812 100644 --- a/util/config.go +++ b/util/config.go @@ -250,6 +250,17 @@ func LoadRunnerSettings(path string) (config RunnerConfig, err error) { // ConfigInit reads in cli flags, and switches actions appropriately on them func ConfigInit(configPath string) { fmt.Println("Loading config") + + Config = &ConfigType{} + Config.Apps = map[string]App{ + "ansible": {}, + "terraform": {}, + "tofu": {}, + "bash": {}, + "powershell": {}, + "python": {}, + } + loadConfigFile(configPath) loadConfigEnvironment() loadConfigDefaults() @@ -800,7 +811,7 @@ func (conf *ConfigType) GenerateSecrets() { conf.AccessKeyEncryption = base64.StdEncoding.EncodeToString(accessKeyEncryption) } -func CheckDefaultApps() { +func LookupDefaultApps() { appCommands := map[string]string{ "": "ansible-playbook", "terraform": "terraform",