Semaphore/db_lib/AppFactory.go

25 lines
518 B
Go
Raw Normal View History

2024-01-30 16:42:56 +01:00
package db_lib
import (
"github.com/ansible-semaphore/semaphore/db"
2024-02-04 21:38:15 +01:00
"github.com/ansible-semaphore/semaphore/lib"
2024-01-30 16:42:56 +01:00
)
2024-02-04 21:38:15 +01:00
func CreateApp(template db.Template, repository db.Repository, logger lib.Logger) LocalApp {
2024-01-30 16:42:56 +01:00
switch template.App {
case db.TemplateAnsible:
return &AnsibleApp{
Template: template,
Repository: repository,
2024-02-04 21:38:15 +01:00
Logger: logger,
2024-01-30 16:42:56 +01:00
Playbook: &AnsiblePlaybook{
TemplateID: template.ID,
Repository: repository,
Logger: logger,
2024-01-30 16:42:56 +01:00
},
}
default:
panic("unknown app")
}
}