Browse Source

Add write/read config value functions

Kristan Kenney 5 years ago
parent
commit
71c2027ca4
1 changed files with 17 additions and 0 deletions
  1. 17 0
      func/syshealth.sh

+ 17 - 0
func/syshealth.sh

@@ -2,6 +2,14 @@
 
 # Hestia Control Panel - System Health Check Function Library
 
+# Read known configuration keys from $HESTIA/conf/defaults/$system.conf
+function read_kv_config_file () {
+    local system=$1
+    while read -r str; do
+        echo "$str"
+    done < <(cat $HESTIA/conf/defaults/$system.conf)
+    unset system
+}
 
 # Write known configuration keys to $HESTIA/conf/defaults/
 function write_kv_config_file () {
@@ -116,6 +124,15 @@ function syshealth_update_ip_config_format () {
     unset known_keys
 }
 
+# Sanitize web domain configuration
+function syshealth_sanitize_config() {
+    local system=$1
+    known_keys=$(read_kv_config_file "$system")
+    for key in $known_keys; do
+        unset $key
+    done
+}
+
 # Repair System Configuration
 # Adds missing variables to $HESTIA/conf/hestia.conf with safe default values
 function syshealth_repair_system_config () {