Changed behavior for default_arch variable
This commit is contained in:
parent
6479071fd7
commit
9d8491a77a
6 changed files with 21 additions and 13 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
Reference in a new issue