Start of cron implementation

main
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 100644
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 100644
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) ?
}

View File

@ -5,6 +5,7 @@ import server
import cli
import build
import git
import cron
fn main() {
mut app := cli.Command{
@ -25,6 +26,7 @@ fn main() {
server.cmd(),
build.cmd(),
git.cmd(),
cron.cmd()
]
}