瀏覽代碼

Fixed False or empty python variables being converted to blank bash variables in kofi.py

deadtom 1 月之前
父節點
當前提交
fbd3167c41
共有 1 個文件被更改,包括 6 次插入0 次删除
  1. 6 0
      upgrade.sh

+ 6 - 0
upgrade.sh

@@ -14,6 +14,12 @@ update_modules() {
 
 update_config() {
     KOFI_TOKEN=$(grep "^KOFI_TOKEN" instance/config.py | cut -d'=' -f2 | cut -d'#' -f1 | tr -d '[:space:]')  # Get the value of KOFI_TOKEN
+    if [ "$KOFI_TOKEN" = "False" ]; then  # So bash doesn't blank the variable in kofi.py if it's False
+        KOFI_TOKEN="False" 
+    fi
+    if [ -z "$KOFI_INTEGRATION" ]; then  # So bash doesn't blank the variable in kofi.py if it's empty.
+        KOFI_INTEGRATION="''"
+    fi
     KOFI_INTEGRATION=$(grep "^KOFI_INTEGRATION" instance/config.py | cut -d'=' -f2 | cut -d'#' -f1 | tr -d '[:space:]')  # Get the value of KOFI_INTEGRATION    
     sed -i "s/}/, \'token\': ${KOFI_TOKEN}, \'integration\': ${KOFI_INTEGRATION}}/" instance/kofi.py  # Append those values to kofi.py 
     sed -i "/^KOFI_TOKEN/d" instance/config.py  # Delete KOFI_TOKEN line from config.py