initial commit

This commit is contained in:
2022-02-04 20:23:04 +01:00
parent 0c44f26522
commit 2b614f6bd3
21 changed files with 1236 additions and 1 deletions

26
cmd/config.go Normal file
View File

@@ -0,0 +1,26 @@
package main
import (
gocron_server "github.com/strnophix/gocron-server/pkg"
)
type ServerConfig struct {
Host string `toml:"host"`
}
type UnitConfig struct {
Name string `toml:"name"`
Command string `toml:"command"`
Cron string `toml:"cron"`
}
func (u *UnitConfig) ToSchedulerUnit() *gocron_server.SchedulerUnit {
cmd := gocron_server.NewUnitExecCmd(u.Command)
unit := gocron_server.NewSchedulerUnit(u.Name, u.Cron, cmd)
return unit
}
type Config struct {
Server ServerConfig `toml:"server"`
Unit []UnitConfig `toml:"unit"`
}