2022-04-06 16:52:31 +02:00
|
|
|
module server
|
|
|
|
|
|
|
|
import cli
|
2022-06-15 13:20:29 +02:00
|
|
|
import vieter.vconf
|
2022-04-06 16:52:31 +02:00
|
|
|
|
2022-04-06 18:20:14 +02:00
|
|
|
struct Config {
|
|
|
|
pub:
|
|
|
|
log_level string = 'WARN'
|
|
|
|
pkg_dir string
|
2022-05-03 16:54:12 +02:00
|
|
|
data_dir string
|
2022-04-06 18:20:14 +02:00
|
|
|
api_key string
|
2022-04-07 13:47:06 +02:00
|
|
|
default_arch string
|
2022-04-06 18:20:14 +02:00
|
|
|
}
|
|
|
|
|
2022-04-06 17:57:05 +02:00
|
|
|
// cmd returns the cli submodule that handles starting the server
|
2022-04-06 16:52:31 +02:00
|
|
|
pub fn cmd() cli.Command {
|
|
|
|
return cli.Command{
|
|
|
|
name: 'server'
|
2022-04-06 19:51:54 +02:00
|
|
|
description: 'Start the Vieter server.'
|
2022-04-06 16:52:31 +02:00
|
|
|
execute: fn (cmd cli.Command) ? {
|
2022-05-14 20:06:08 +02:00
|
|
|
config_file := cmd.flags.get_string('config-file')?
|
2022-06-15 22:54:27 +02:00
|
|
|
conf := vconf.load<Config>(prefix: 'VIETER_', default_path: config_file)?
|
2022-04-06 16:52:31 +02:00
|
|
|
|
2022-05-14 20:06:08 +02:00
|
|
|
server(conf)?
|
2022-04-06 16:52:31 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|