refactor: unify command declaration across codebase
This commit is contained in:
@@ -6,9 +6,10 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/property-functions"
|
||||
|
||||
cmd-nginx-report() {
|
||||
declare desc="displays a nginx report for one or more apps"
|
||||
local cmd="nginx:report"
|
||||
declare cmd="nginx:report"
|
||||
[[ "$1" == "$cmd" ]] && shift 1
|
||||
declare APP="$1" INFO_FLAG="$2"
|
||||
local INSTALLED_APPS=$(dokku_apps)
|
||||
local APP="$2" INFO_FLAG="$3"
|
||||
|
||||
if [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
|
||||
INFO_FLAG="$APP"
|
||||
|
||||
@@ -6,7 +6,8 @@ source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/functions"
|
||||
|
||||
cmd-nginx-logs() {
|
||||
declare desc="display app nginx logs from command line"
|
||||
local cmd="$1"
|
||||
declare cmd="$1"
|
||||
|
||||
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
|
||||
nginx_logs "$@"
|
||||
}
|
||||
|
||||
@@ -6,8 +6,10 @@ source "$PLUGIN_AVAILABLE_PATH/proxy/functions"
|
||||
|
||||
cmd-nginx-build-config() {
|
||||
declare desc="build nginx config to proxy app containers from command line"
|
||||
declare APP="$2"
|
||||
local cmd="nginx:build-config"
|
||||
declare cmd="nginx:build-config"
|
||||
[[ "$1" == "$cmd" ]] && shift 1
|
||||
declare APP="$1"
|
||||
|
||||
[[ -z "$APP" ]] && dokku_log_fail "Please specify an app to run the command on"
|
||||
local PROXY_APP_TYPE
|
||||
PROXY_APP_TYPE="$(get_app_proxy_type "$APP")"
|
||||
|
||||
@@ -6,10 +6,11 @@ set -eo pipefail
|
||||
|
||||
cmd-nginx-set() {
|
||||
declare desc="set or clear an nginx property for an app"
|
||||
local cmd="nginx:set" argv=("$@")
|
||||
[[ ${argv[0]} == "$cmd" ]] && shift 1
|
||||
declare cmd="nginx:set"
|
||||
[[ "$1" == "$cmd" ]] && shift 1
|
||||
declare APP="$1" KEY="$2" VALUE="$3"
|
||||
local VALID_KEYS=("bind-address-ipv4" "bind-address-ipv6" "hsts" "hsts-include-subdomains" "hsts-preload" "hsts-max-age")
|
||||
|
||||
[[ -z "$APP" ]] && dokku_log_fail "Please specify an app to run the command on"
|
||||
[[ -z "$KEY" ]] && dokku_log_fail "No key specified"
|
||||
|
||||
|
||||
@@ -5,11 +5,11 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
|
||||
cmd-nginx-show-conf() {
|
||||
declare desc="display app nginx config"
|
||||
declare cmd="nginx:show-conf" argv=("$@")
|
||||
[[ ${argv[0]} == "$cmd" ]] && shift 1
|
||||
declare cmd="nginx:show-conf"
|
||||
[[ "$1" == "$cmd" ]] && shift 1
|
||||
declare APP="$1"
|
||||
verify_app_name "$APP"
|
||||
|
||||
verify_app_name "$APP"
|
||||
if [[ ! -f "$DOKKU_ROOT/$APP/nginx.conf" ]]; then
|
||||
dokku_log_fail "No nginx.conf exists for $APP"
|
||||
fi
|
||||
|
||||
@@ -6,9 +6,11 @@ source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/functions"
|
||||
|
||||
cmd-nginx-validate() {
|
||||
declare desc="validates and optionally cleans up invalid nginx configurations"
|
||||
declare cmd="nginx:validate" argv=("$@")
|
||||
[[ ${argv[0]} == "$cmd" ]] && shift 1
|
||||
validate_nginx "$@"
|
||||
declare cmd="nginx:validate"
|
||||
[[ "$1" == "$cmd" ]] && shift 1
|
||||
declare APP="$1" FLAG="$2"
|
||||
|
||||
validate_nginx "$APP" "$FLAG"
|
||||
}
|
||||
|
||||
cmd-nginx-validate "$@"
|
||||
|
||||
Reference in New Issue
Block a user