dynvars
Improved command for dynvars. Removed the old command.
This commit is contained in:
parent
1a26eed7c1
commit
d1505bd4c0
2 changed files with 8 additions and 15 deletions
|
@ -597,15 +597,8 @@ check_for_parameters() {
|
|||
local par=$(echo "${arg}" | cut -d'=' -f 1 -s)
|
||||
local val=$(echo "${arg}" | cut -d'=' -f 2 -s)
|
||||
[[ -z $par ]] && par=$arg
|
||||
[[ -z $val && $par == "conf-value_"* ]] && val="NeverMatchString" #Special value to allow the string "true" as a valid value.
|
||||
[[ -z $val ]] && val=true
|
||||
|
||||
# Check for Webinoly -conf-value_
|
||||
if [[ $par == "conf-value_"* ]]; then
|
||||
dyn_var=$(echo "${par}" | cut -d'_' -f 2 -s)
|
||||
par=$(echo "${par}" | cut -d'_' -f 1 -s)
|
||||
fi
|
||||
|
||||
# Convert to lowercase and support for hyphen in arguments.
|
||||
par=${par,,}
|
||||
par=$(echo $par | sed "s/-/_/g")
|
||||
|
|
16
usr/webinoly
16
usr/webinoly
|
@ -2,8 +2,8 @@
|
|||
|
||||
# Webinoly Server Manager Plugin
|
||||
# Syntax: webinoly <option> <argument>
|
||||
# Options: -update, -server-reset, -verify, -dbpass, -tools-port, -login-www-data, -cache-valid, -uninstall, -info, -external-sources-update, -clear-cache, -version, -blockip, -conf-value_, -default-site, -tools-site, -mysql-password, -smtp, -backup, -aws-s3-credentials, -db-import, -send-to-s3, -custom-headers, -skip-cache, -skip-cookie-cache, -query-string-cache, -query-string-never-cache, -email, -export, -import, -mysql-public-access
|
||||
# Arguments: -raw, -profile, -list, -bucket, -source, -delete, -run, -restore, -wp, -destination, -date, -s3-european-buckets, info, -file, -add-db-pre, -no-recovery, -recalculate, -dbname, -skip-db, -filename, -overwrite
|
||||
# Options: -update, -server-reset, -verify, -dbpass, -tools-port, -login-www-data, -cache-valid, -uninstall, -info, -external-sources-update, -clear-cache, -version, -blockip, -dynvar, -default-site, -tools-site, -mysql-password, -smtp, -backup, -aws-s3-credentials, -db-import, -send-to-s3, -custom-headers, -skip-cache, -skip-cookie-cache, -query-string-cache, -query-string-never-cache, -email, -export, -import, -mysql-public-access
|
||||
# Arguments: -raw, -profile, -list, -bucket, -source, -delete, -run, -restore, -wp, -destination, -date, -s3-european-buckets, info, -file, -add-db-pre, -no-recovery, -recalculate, -dbname, -skip-db, -filename, -overwrite, -value
|
||||
|
||||
source /opt/webinoly/lib/webin
|
||||
source /opt/webinoly/lib/datadog
|
||||
|
@ -113,12 +113,12 @@ elif [[ -n $blockip ]]; then
|
|||
nginx_blockip
|
||||
|
||||
|
||||
elif [[ -n $conf_value ]]; then
|
||||
if [[ -n $dyn_var && $dyn_var =~ ^[A-Za-z\-]+$ ]]; then
|
||||
[[ $conf_value == "NeverMatchString" ]] && read -p "${blu}Enter a value for '${dyn_var}': ${end}" conf_value
|
||||
if [[ -n $conf_value ]]; then
|
||||
conf_write $dyn_var $conf_value
|
||||
echo "${gre}Configuration successfully updated!${end}"
|
||||
elif [[ -n $dynvar ]]; then
|
||||
if [[ -n $dynvar && $dynvar =~ ^[A-Za-z\-]+$ ]]; then
|
||||
[[ -z $value ]] && read -p "${blu}Enter a value for '${dynvar}': ${end}" value
|
||||
if [[ -n $value ]]; then
|
||||
conf_write $dynvar "$value"
|
||||
echo "${gre}Configuration successfully updated! ${dim}(${dynvar}:$(conf_read $dynvar))${end}" # Retrive the value to really be sure!
|
||||
else
|
||||
echo "${red}[ERROR] Please, enter a valid value!${end}"
|
||||
exit 1
|
||||
|
|
Loading…
Add table
Reference in a new issue