mirror of
https://github.com/semaphoreui/semaphore.git
synced 2024-11-23 12:30:41 +01:00
feat: lookup default apps
This commit is contained in:
parent
3ce78b11fd
commit
a6133354c1
@ -110,6 +110,8 @@ func createStore(token string) db.Store {
|
|||||||
|
|
||||||
err = db.FillConfigFromDB(store)
|
err = db.FillConfigFromDB(store)
|
||||||
|
|
||||||
|
util.CheckDefaultApps()
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
@ -786,3 +786,28 @@ func (conf *ConfigType) GenerateSecrets() {
|
|||||||
conf.CookieEncryption = base64.StdEncoding.EncodeToString(encryption)
|
conf.CookieEncryption = base64.StdEncoding.EncodeToString(encryption)
|
||||||
conf.AccessKeyEncryption = base64.StdEncoding.EncodeToString(accessKeyEncryption)
|
conf.AccessKeyEncryption = base64.StdEncoding.EncodeToString(accessKeyEncryption)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func CheckDefaultApps() {
|
||||||
|
appCommands := map[string]string{
|
||||||
|
"": "ansible-playbook",
|
||||||
|
"terraform": "terraform",
|
||||||
|
"tofu": "tofu",
|
||||||
|
"bash": "bash",
|
||||||
|
}
|
||||||
|
|
||||||
|
for app, cmd := range appCommands {
|
||||||
|
if _, ok := Config.Apps[app]; ok {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
_, err := exec.LookPath(cmd)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
Config.Apps[app] = AppConfig{
|
||||||
|
Active: true,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user