mirror of
https://github.com/SecurityBrewery/catalyst.git
synced 2025-12-06 23:32:47 +01:00
Release catalyst
This commit is contained in:
26
automation/automation.go
Normal file
26
automation/automation.go
Normal file
@@ -0,0 +1,26 @@
|
||||
package automation
|
||||
|
||||
import (
|
||||
"context"
|
||||
"log"
|
||||
|
||||
"github.com/SecurityBrewery/catalyst/bus"
|
||||
"github.com/SecurityBrewery/catalyst/database"
|
||||
"github.com/SecurityBrewery/catalyst/database/busdb"
|
||||
"github.com/SecurityBrewery/catalyst/generated/models"
|
||||
"github.com/SecurityBrewery/catalyst/role"
|
||||
)
|
||||
|
||||
func New(apiurl, apikey string, bus *bus.Bus, db *database.Database) error {
|
||||
if err := jobAutomation(jobContext(), apiurl, apikey, bus, db); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
return resultAutomation(bus, db)
|
||||
}
|
||||
|
||||
func jobContext() context.Context {
|
||||
// TODO: change roles?
|
||||
bot := &models.UserResponse{ID: "bot", Roles: []string{role.Admin}}
|
||||
return busdb.UserContext(context.Background(), bot)
|
||||
}
|
||||
Reference in New Issue
Block a user