mirror of
https://github.com/semaphoreui/semaphore.git
synced 2024-11-23 20:35:24 +01:00
fix(apps): init apps in config
This commit is contained in:
parent
08a09492ee
commit
37230c2f2b
15
api/apps.go
15
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,
|
||||
|
@ -114,7 +114,7 @@ func createStore(token string) db.Store {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
util.CheckDefaultApps()
|
||||
util.LookupDefaultApps()
|
||||
|
||||
return store
|
||||
}
|
||||
|
@ -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",
|
||||
|
Loading…
Reference in New Issue
Block a user