fix: ability to use default cache in scripts (#274)

This commit is contained in:
Amir Zarrinkafsh 2025-08-17 06:05:58 +10:00 committed by GitHub
parent 098c1e9c54
commit 170c0905e4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 7 additions and 13 deletions

View File

@ -12,3 +12,4 @@ indent_size = 0
[*.sh] [*.sh]
indent_style = tab indent_style = tab

View File

@ -13,7 +13,6 @@ if ! command -v jq >/dev/null; then
exit 1 exit 1
fi fi
cachenamedefault="disabled"
combinedoutput=$(jq -r ".combined_output" config.json) combinedoutput=$(jq -r ".combined_output" config.json)
while read -r line; do while read -r line; do
@ -34,7 +33,7 @@ while read -r entry; do
key=$(jq -r ".cache_domains[$entry].name" ${path}) key=$(jq -r ".cache_domains[$entry].name" ${path})
cachename="cachename${key}" cachename="cachename${key}"
if [ -z "${!cachename}" ]; then if [ -z "${!cachename}" ]; then
cachename=${cachenamedefault} cachename="cachenamedefault"
fi fi
if [[ ${cachename} == "disabled" ]]; then if [[ ${cachename} == "disabled" ]]; then
continue continue

View File

@ -13,7 +13,6 @@ if ! command -v jq >/dev/null; then
exit 1 exit 1
fi fi
cachenamedefault="disabled"
combinedoutput=$(jq -r ".combined_output" config.json) combinedoutput=$(jq -r ".combined_output" config.json)
while read -r line; do while read -r line; do
@ -34,7 +33,7 @@ while read -r entry; do
key=$(jq -r ".cache_domains[${entry}].name" ${path}) key=$(jq -r ".cache_domains[${entry}].name" ${path})
cachename="cachename${key}" cachename="cachename${key}"
if [ -z "${!cachename}" ]; then if [ -z "${!cachename}" ]; then
cachename=${cachenamedefault} cachename="cachenamedefault"
fi fi
if [[ ${cachename} == "disabled" ]]; then if [[ ${cachename} == "disabled" ]]; then
continue continue

View File

@ -14,8 +14,6 @@ if ! command -v jq >/dev/null; then
exit 1 exit 1
fi fi
cachenamedefault="disabled"
while read -r line; do while read -r line; do
ip=$(jq ".ips[\"${line}\"]" config.json) ip=$(jq ".ips[\"${line}\"]" config.json)
declare "cacheip${line}"="${ip}" declare "cacheip${line}"="${ip}"
@ -50,7 +48,7 @@ while read -r entry; do
key=$(jq -r ".cache_domains[${entry}].name" ${path}) key=$(jq -r ".cache_domains[${entry}].name" ${path})
cachename="cachename${key}" cachename="cachename${key}"
if [ -z "${!cachename}" ]; then if [ -z "${!cachename}" ]; then
cachename=${cachenamedefault} cachename="cachenamedefault"
fi fi
if [[ ${cachename} == "disabled" ]]; then if [[ ${cachename} == "disabled" ]]; then
continue continue

View File

@ -14,8 +14,6 @@ if ! command -v jq >/dev/null; then
exit 1 exit 1
fi fi
cachenamedefault="disabled"
while read -r line; do while read -r line; do
name=$(jq -r ".cache_domains[\"${line}\"]" config.json) name=$(jq -r ".cache_domains[\"${line}\"]" config.json)
declare "cachename${line}"="${name}" declare "cachename${line}"="${name}"
@ -28,7 +26,7 @@ while read -r entry; do
key=$(jq -r ".cache_domains[$entry].name" ${path}) key=$(jq -r ".cache_domains[$entry].name" ${path})
cachename="cachename${key}" cachename="cachename${key}"
if [ -z "${!cachename}" ]; then if [ -z "${!cachename}" ]; then
cachename=${cachenamedefault} cachename="cachenamedefault"
fi fi
if [[ ${cachename} == "disabled" ]]; then if [[ ${cachename} == "disabled" ]]; then
continue continue

View File

@ -13,7 +13,6 @@ if ! command -v jq >/dev/null; then
exit 1 exit 1
fi fi
cachenamedefault="disabled"
combinedoutput=$(jq -r ".combined_output" config.json) combinedoutput=$(jq -r ".combined_output" config.json)
while read -r line; do while read -r line; do
@ -34,7 +33,7 @@ while read -r entry; do
key=$(jq -r ".cache_domains[${entry}].name" ${path}) key=$(jq -r ".cache_domains[${entry}].name" ${path})
cachename="cachename${key}" cachename="cachename${key}"
if [ -z "${!cachename}" ]; then if [ -z "${!cachename}" ]; then
cachename=${cachenamedefault} cachename="cachenamedefault"
fi fi
if [[ ${cachename} == "disabled" ]]; then if [[ ${cachename} == "disabled" ]]; then
continue continue