Start of cron implementation

This commit is contained in:
Jef Roosens 2022-04-09 09:46:07 +02:00
parent 8b2900d7f3
commit 41ee08045b
3 changed files with 35 additions and 0 deletions

26
src/cron/cli.v Normal file
View file

@ -0,0 +1,26 @@
module cron
import cli
import env
struct Config {
pub:
log_level string = 'WARN'
log_file string = 'vieter.log'
api_key string
address string
base_image string = 'archlinux:base-devel'
}
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) ?
}
}
}

7
src/cron/cron.v Normal file
View file

@ -0,0 +1,7 @@
module cron
import git
pub fn cron(conf Config) ? {
repos_map := git.get_repos(conf.address, conf.api_key) ?
}