fix: exit with error if missing informations 🐛

This commit is contained in:
2024-10-30 10:07:42 +13:00
parent 1f18b83405
commit 8402f345cf

View File

@@ -37,30 +37,31 @@ action_error() {
# Verify that the minimally required password settings are set for operation. # Verify that the minimally required password settings are set for operation.
function verify_minimum_env { function verify_minimum_env {
if [ -z "$username" ]; then if [ -z "$username" ]; then
action_warn "username is required for plugin operation" action_warn "username is required for action operation"
fi fi
if [ -z "$baseurl" ]; then if [ -z "$baseurl" ]; then
action_warn "gitea_baseurl setting is required for plugin operation" action_warn "baseurl setting is required for action operation"
fi fi
if [ -z "$owner" ]; then if [ -z "$owner" ]; then
action_warn "gitea_owner setting is required for plugin operation" action_warn "owner setting is required for action operation"
fi fi
if [ -z "$access_token" ]; then if [ -z "$access_token" ]; then
action_warn "gitea_token setting is required for plugin operation" action_warn "access_token setting is required for action operation"
fi fi
if [ -z "$version" ]; then if [ -z "$version" ]; then
action_warn "gitea_version setting is required for plugin operation" action_warn "version setting is required for action operation"
fi fi
if [ -z "$username" ] || if [ -z "$username" ] ||
[ -z "$baseurl" ] || [ -z "$baseurl" ] ||
[ -z "$version" ] || [ -z "$version" ] ||
[ -z "$access_token" ]; then [ -z "$access_token" ]; then
action_error <<-'EOF' action_error <<-'EOF'
You need to specify one/all of the following settings: You need to specify one/all of the following settings:
- username - username
- access_token - access_token
- baseurl - baseurl
EOF EOF
exit 1
fi fi
action_note "Sufficient configuration" action_note "Sufficient configuration"
@@ -132,7 +133,6 @@ function process_upload_file {
_main() { _main() {
action_note "Starting" action_note "Starting"
env | sort
verify_minimum_env "$@" verify_minimum_env "$@"
process_upload_file "$@" process_upload_file "$@"
} }