Skip to content

Commit d09db20

Browse files
authored
add browsers-file to goan_config if ENABLE_BROWSERS_LIST true
- If the user sets the env variable `ENABLE_BROWSERS_LIST` to true, their `goaccess.conf` file is modified to include the `browsers-file` which points to the `/goaccess-config/browsers.list` file. - In the event that the user's `goaccess.conf` file already references a `browsers.list` file, the `/goaccess-config/browsers.list` file is ignored in favor of the user's file.
1 parent 3e26ad9 commit d09db20

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

resources/scripts/logs/custom.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,15 @@ function custom_init(){
2929
fi
3030
if [[ -r ${goan_config} ]]; then
3131
echo -e "goaccess.conf readable"
32+
if [[ "${ENABLE_BROWSERS_LIST}" == "True" || ${ENABLE_BROWSERS_LIST} == true ]]; then
33+
if grep -Fwq "browsers-file" ${goan_config}; then
34+
echo -e "\n\t\BROWSERS FILE ALREADY DEFINED IN CUSTOM GOACCESS.CONF. IGNORING CUSTOM_BROWSERS VARIABLE"
35+
else
36+
echo -e "\n\tENABLING CUSTOM INSTANCE GOACCESS BROWSERS LIST"
37+
browsers_file="/goaccess-config/browsers.list"
38+
echo "browsers-file ${browsers_file}" >> ${goan_config}
39+
fi
40+
fi
3241
else
3342
echo -e "goaccess.conf not readable"
3443
#exit
@@ -61,4 +70,4 @@ function custom(){
6170
/goaccess/goaccess --no-global-config --config-file=${goan_config} &
6271
fi
6372

64-
}
73+
}

0 commit comments

Comments
 (0)