vieter/src/cron/cli.v

33 lines
851 B
Coq
Raw Normal View History

2022-04-09 09:46:07 +02:00
module cron
import cli
2022-11-01 21:43:25 +01:00
import conf as vconf
2022-04-09 09:46:07 +02:00
struct Config {
pub:
log_level string = 'WARN'
api_key string
address string
data_dir string
base_image string = 'archlinux:base-devel'
max_concurrent_builds int = 1
api_update_frequency int = 15
image_rebuild_frequency int = 1440
// Replicates the behavior of the original cron system
global_schedule string = '0 3'
2022-04-09 09:46:07 +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.'
2022-11-01 21:10:45 +01:00
execute: fn (cmd cli.Command) ! {
config_file := cmd.flags.get_string('config-file')!
conf := vconf.load<Config>(prefix: 'VIETER_', default_path: config_file)!
2022-04-09 09:46:07 +02:00
2022-11-01 21:10:45 +01:00
cron(conf)!
2022-04-09 09:46:07 +02:00
}
}
}