2022-12-06 13:50:25 +01:00
|
|
|
module agent
|
|
|
|
|
|
|
|
import cli
|
|
|
|
import conf as vconf
|
|
|
|
|
|
|
|
struct Config {
|
|
|
|
pub:
|
2022-12-12 22:58:43 +01:00
|
|
|
log_level string = 'WARN'
|
2022-12-12 22:09:57 +01:00
|
|
|
// Architecture that the agent represents
|
2022-12-13 17:42:49 +01:00
|
|
|
arch string
|
|
|
|
api_key string
|
|
|
|
address string
|
|
|
|
data_dir string
|
|
|
|
max_concurrent_builds int = 1
|
|
|
|
polling_frequency int = 30
|
2022-12-12 21:50:34 +01:00
|
|
|
image_rebuild_frequency int = 1440
|
2022-12-06 13:50:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// cmd returns the cli module that handles the cron daemon.
|
|
|
|
pub fn cmd() cli.Command {
|
|
|
|
return cli.Command{
|
|
|
|
name: 'agent'
|
2022-12-13 17:42:49 +01:00
|
|
|
description: 'Start an agent daemon.'
|
2022-12-06 13:50:25 +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)!
|
|
|
|
|
|
|
|
agent(conf)!
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|