feat(config_migrate): always remove domain old key & replace old value by new value

pull/5032/head
Scruel Tao 9 months ago committed by GitHub
parent aa8cf76fb1
commit 2cbdf274b1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -2393,16 +2393,21 @@ _readdomainconf() {
#_migratedomainconf oldkey newkey base64encode #_migratedomainconf oldkey newkey base64encode
_migratedomainconf() { _migratedomainconf() {
_old_key="$1"   _old_key="$1"
_new_key="$2"   _new_key="$2"
_b64encode="$3"   _b64encode="$3"
_value=$(_readdomainconf "$_old_key")   _old_value=$(_readdomainconf "$_old_key")
if [ -z "$_value" ]; then   _cleardomainconf "$_old_key"
return 1 # oldkey is not found   if [ -z "$_old_value" ]; then
fi     return 1 # migrated failed: old value is empty
_savedomainconf "$_new_key" "$_value" "$_b64encode"   fi
_cleardomainconf "$_old_key"   _new_value=$(_readdomainconf "$_new_key")
_debug "Domain config $_old_key has been migrated to $_new_key"   if [ -n "$_new_value" ]; then
    _debug "Domain config new key exists, old key $_old_key='$_old_value' has been removed."
    return 1 # migrated failed: old value replaced by new value
  fi
  _savedomainconf "$_new_key" "$_old_value" "$_b64encode"
  _debug "Domain config $_old_key has been migrated to $_new_key."
} }
#_migratedeployconf oldkey newkey base64encode #_migratedeployconf oldkey newkey base64encode

Loading…
Cancel
Save