chore: reorder functions

This commit is contained in:
Jose Diaz-Gonzalez
2019-05-30 11:13:22 -04:00
parent 44c0d80e31
commit d97376cc48

View File

@@ -84,6 +84,18 @@ is_implemented_command() {
return 0
}
is_valid_service_name() {
declare desc="Validates a service name"
declare SERVICE="$1"
[[ -z "$SERVICE" ]] && return 1
if [[ "$SERVICE" =~ ^[A-Za-z0-9_]+$ ]]; then
return 0
fi
return 1
}
remove_from_links_file() {
declare desc="Removes an app from the service link file"
declare SERVICE="$1" APP="$2"
@@ -119,13 +131,6 @@ retry-docker-command() {
[[ "$success" == "true" ]] || dokku_log_fail "Failed to run command: ${COMMAND}"
}
service_dns_hostname() {
declare desc="Retrieves the alias of a service"
declare SERVICE="$1"
local SERVICE_NAME="$(get_service_name "$SERVICE")"
echo "$SERVICE_NAME" | tr ._ -
}
service_alternative_alias() {
declare desc="Retrieves an alternative alias for a service"
declare EXISTING_CONFIG="$1"
@@ -271,14 +276,6 @@ service_backup_schedule_cat() {
cat "$CRON_FILE"
}
service_backup_unschedule() {
declare desc="unschedules the backup of the service"
declare SERVICE="$1"
local CRON_FILE="/etc/cron.d/dokku-${PLUGIN_COMMAND_PREFIX}-${SERVICE}"
sudo /bin/rm -f "$CRON_FILE"
}
service_backup_set_encryption() {
declare desc="Sets up backup encryption"
declare SERVICE="$1" ENCRYPTION_KEY="$2"
@@ -289,6 +286,14 @@ service_backup_set_encryption() {
echo "$ENCRYPTION_KEY" >"${SERVICE_BACKUP_ENCRYPTION_ROOT}/ENCRYPTION_KEY"
}
service_backup_unschedule() {
declare desc="unschedules the backup of the service"
declare SERVICE="$1"
local CRON_FILE="/etc/cron.d/dokku-${PLUGIN_COMMAND_PREFIX}-${SERVICE}"
sudo /bin/rm -f "$CRON_FILE"
}
service_backup_unset_encryption() {
declare desc="Removes backup encryption"
declare SERVICE="$1"
@@ -318,6 +323,13 @@ service_container_rm() {
fi
}
service_dns_hostname() {
declare desc="Retrieves the alias of a service"
declare SERVICE="$1"
local SERVICE_NAME="$(get_service_name "$SERVICE")"
echo "$SERVICE_NAME" | tr ._ -
}
service_enter() {
declare desc="enters running app container of specified proc type"
declare SERVICE="$1" && shift 1
@@ -768,15 +780,3 @@ verify_service_name() {
[[ ! -d "$PLUGIN_DATA_ROOT/$SERVICE" ]] && dokku_log_fail "$PLUGIN_SERVICE service $SERVICE does not exist"
return 0
}
is_valid_service_name() {
declare desc="Validates a service name"
declare SERVICE="$1"
[[ -z "$SERVICE" ]] && return 1
if [[ "$SERVICE" =~ ^[A-Za-z0-9_]+$ ]]; then
return 0
fi
return 1
}