Changed behavior for default_arch variable
Some checks failed
ci/woodpecker/push/arch unknown status
ci/woodpecker/push/deploy unknown status
ci/woodpecker/push/docker unknown status
ci/woodpecker/push/lint Pipeline was successful
ci/woodpecker/push/build Pipeline was successful

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

View file

@ -12,6 +12,7 @@ pub:
api_key string
data_dir string
repos_file string
default_arch string
}
// cmd returns the cli submodule that handles starting the server

View file

@ -58,10 +58,6 @@ fn (mut app App) put_package(repo string) web.Result {
// Generate a random filename for the temp file
pkg_path = os.join_path_single(app.conf.download_dir, rand.uuid_v4())
for os.exists(pkg_path) {
pkg_path = os.join_path_single(app.conf.download_dir, rand.uuid_v4())
}
app.ldebug("Uploading $length bytes (${util.pretty_bytes(length.int())}) to '$pkg_path'.")
// This is used to time how long it takes to upload a file

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)
}