2022-04-09 09:46:07 +02:00
|
|
|
module cron
|
|
|
|
|
|
|
|
import cli
|
|
|
|
import env
|
|
|
|
|
|
|
|
struct Config {
|
|
|
|
pub:
|
2022-04-09 09:50:37 +02:00
|
|
|
log_level string = 'WARN'
|
|
|
|
log_file string = 'vieter.log'
|
|
|
|
api_key string
|
|
|
|
address string
|
2022-04-09 09:46:07 +02:00
|
|
|
base_image string = 'archlinux:base-devel'
|
2022-04-13 15:24:55 +02:00
|
|
|
max_concurrent_builds int = 1
|
|
|
|
api_update_frequency int = 60
|
|
|
|
global_schedule string
|
2022-04-09 09:46:07 +02:00
|
|
|
}
|
|
|
|
|
2022-04-12 21:23:38 +02:00
|
|
|
// cmd returns the cli module that handles the cron daemon.
|
2022-04-09 09:46:07 +02:00
|
|
|
pub fn cmd() cli.Command {
|
|
|
|
return cli.Command{
|
|
|
|
name: 'cron'
|
|
|
|
description: 'Start the cron service that periodically runs builds.'
|
|
|
|
execute: fn (cmd cli.Command) ? {
|
|
|
|
config_file := cmd.flags.get_string('config-file') ?
|
|
|
|
conf := env.load<Config>(config_file) ?
|
|
|
|
|
|
|
|
cron(conf) ?
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|