Changed behavior for default_arch variable

This commit is contained in:
Jef Roosens 2022-04-07 13:47:06 +02:00
parent 6479071fd7
commit 9d8491a77a
Signed by untrusted user: Jef Roosens
GPG key ID: B75D4F293C7052DB
6 changed files with 21 additions and 13 deletions

View file

@ -20,6 +20,11 @@ pub mut:
// server starts the web server & starts listening for requests
pub fn server(conf Config) ? {
// Prevent using 'any' as the default arch
if conf.default_arch == 'any' {
util.exit_with_message(1, "'any' is not allowed as the value for default_arch.")
}
// Configure logger
log_level := log.level_from_tag(conf.log_level) or {
util.exit_with_message(1, 'Invalid log level. The allowed values are FATAL, ERROR, WARN, INFO & DEBUG.')
@ -39,7 +44,7 @@ pub fn server(conf Config) ? {
}
// This also creates the directories if needed
repo := repo.new(conf.data_dir, conf.pkg_dir, 'x86_64') or {
repo := repo.new(conf.data_dir, conf.pkg_dir, conf.default_arch) or {
logger.error(err.msg)
exit(1)
}