mirror of
https://github.com/OliveTin/OliveTin
synced 2025-12-16 02:55:39 +00:00
Some checks failed
Build Snapshot / build-snapshot (push) Waiting to run
DevSkim / DevSkim (push) Waiting to run
Buf CI / buf (push) Has been cancelled
CodeQL / Analyze (go) (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
Codestyle checks / codestyle (push) Has been cancelled
31 lines
706 B
Go
31 lines
706 B
Go
package onstartup
|
|
|
|
import (
|
|
"github.com/OliveTin/OliveTin/internal/acl"
|
|
config "github.com/OliveTin/OliveTin/internal/config"
|
|
"github.com/OliveTin/OliveTin/internal/executor"
|
|
log "github.com/sirupsen/logrus"
|
|
)
|
|
|
|
func Execute(cfg *config.Config, ex *executor.Executor) {
|
|
user := acl.UserFromSystem(cfg, "startup")
|
|
|
|
for _, action := range cfg.Actions {
|
|
if action.ExecOnStartup {
|
|
log.WithFields(log.Fields{
|
|
"action": action.Title,
|
|
}).Infof("Startup action")
|
|
|
|
req := &executor.ExecutionRequest{
|
|
ActionTitle: action.Title,
|
|
Arguments: nil,
|
|
Cfg: cfg,
|
|
Tags: []string{},
|
|
AuthenticatedUser: user,
|
|
}
|
|
|
|
ex.ExecRequest(req)
|
|
}
|
|
}
|
|
}
|