Skip to content

Commit 823520f

Browse files
author
ggtrd
committed
improve file config
1 parent 138b5b9 commit 823520f

File tree

2 files changed

+31
-31
lines changed

2 files changed

+31
-31
lines changed

bashpack.sh

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -177,35 +177,35 @@ get_config_value() {
177177
local file=${1}
178178
local option=${2}
179179

180-
while read -r line; do
181-
if [[ $line =~ ^([^=]+)[[:space:]]([^=]+)$ ]]; then
182-
# Test first word (= option name)...
183-
if [[ $option = ${BASH_REMATCH[1]} ]]; then
184-
# ... to get the second word (= value of the option)
185-
echo "${BASH_REMATCH[2]}" # As this is a string, we use echo to return the value
186-
break
187-
fi
188-
else
189-
break
190-
fi
191-
done < "$file"
192-
193-
194180
# while read -r line; do
195-
# # Avoid reading comments and empty lines
196-
# if [[ ${line:0:1} != "#" ]] && [[ ${line:0:1} != "" ]]; then
197-
198-
# if [[ $line =~ ^([^=]+)[[:space:]]([^=]+)$ ]]; then
199-
# # Test first word (= option name)...
200-
# if [[ $option = ${BASH_REMATCH[1]} ]]; then
201-
# # ... to get the second word (= value of the option)
202-
# echo "${BASH_REMATCH[2]}" # As this is a string, we use echo to return the value
203-
# break
204-
# fi
181+
# if [[ $line =~ ^([^=]+)[[:space:]]([^=]+)$ ]]; then
182+
# # Test first word (= option name)...
183+
# if [[ $option = ${BASH_REMATCH[1]} ]]; then
184+
# # ... to get the second word (= value of the option)
185+
# echo "${BASH_REMATCH[2]}" # As this is a string, we use echo to return the value
186+
# break
205187
# fi
188+
# else
189+
# break
190+
# fi
191+
# done < "$file"
192+
206193

207-
# fi
208-
# done < "$file_config_current"
194+
while read -r line; do
195+
# Avoid reading comments and empty lines
196+
if [[ ${line:0:1} != "#" ]] && [[ ${line:0:1} != "" ]]; then
197+
198+
if [[ $line =~ ^([^=]+)[[:space:]]([^=]+)$ ]]; then
199+
# Test first word (= option name)...
200+
if [[ $option = ${BASH_REMATCH[1]} ]]; then
201+
# ... to get the second word (= value of the option)
202+
echo "${BASH_REMATCH[2]}" # As this is a string, we use echo to return the value
203+
break
204+
fi
205+
fi
206+
207+
fi
208+
done < "$file_config_current"
209209
}
210210
export -f get_config_value
211211

config/bashpack_config

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ publication main
1515

1616
# [option] firewall
1717
# This option allow Bashpack to manage the firewall of the system.
18-
# Default is inbounds = closed and outbounds = open. You can add custom rules within the firewall configuration.
19-
# - auto = let manage the firewall with Bashpack.
20-
# - disabled = do not manage the firewall with Bashpack
21-
firewall disabled
18+
# Default ruleset: [inbounds any block] and [outbounds any allow]. You can add custom rules within the firewall configuration.
19+
# - true = let manage the firewall with Bashpack.
20+
# - false = do not manage the firewall with Bashpack
21+
firewall false
2222

23-
#EOF
23+
#EOF

0 commit comments

Comments
 (0)