Files
server/config/config.go
T
restitux bbe9dcaf2a WIP: Replace job execution with runner delegation
Server now accepts runner connections via websockets. Jobs
will be delegated to these runners. This is currently a WIP,
as it is still hardcoded to use the first available runner.
2022-10-16 14:54:49 -06:00

49 lines
760 B
Go

package config
import (
"fmt"
"git.ohea.xyz/golang/config"
)
type Webhook struct {
Secret string
}
type Job struct {
URL *string
Folder *string
Webhook Webhook
Cron *string
}
type Runner struct {
Secret string
}
type Config struct {
Address string
Port int
Jobs map[string]Job
Runners map[string]Runner
}
func GetConfig() (config.Config[Config], error) {
configData := config.Config[Config]{
Name: "cursorius",
Filename: "server",
Config: Config{
Address: "127.0.0.1",
Port: 45420,
Jobs: make(map[string]Job),
Runners: make(map[string]Runner),
},
}
_, err := configData.Get()
if err != nil {
return configData, fmt.Errorf("Could not read config file: %v", err)
}
return configData, nil
}