Added optional ENABLE_BROWSERS_LIST and CUSTOM_BROWSERS variables.
start.sh script changes
When the container is started, the original goaccess browsers.list (located in /goaccess/config/) is copied to the /goaccess-config directory. If the user defined the CUSTOM_BROWSERS variable with a comma delimited list consisting of Browser:Browser_category items, these are appended to the /goaccess-config/browsers.list file.
By checking if browsers.list is already present in the /goaccess-config directory at container runtime and subsequently removing it prior to copying over a fresh copy from the /goaccess/config directory, we can ensure that the browsers.list always aligns with the user's CUSTOM_BROWSERS variable. Since the /goaccess/config/browsers.list file is persistent, appending to it would result in custom browsers being left behind within the file when a user removes browser(s) from the CUSTOM_BROWSERS variable during a container restart - copying over a fresh file prior to appending custom browsers gets around this potential issue.
For user defined CUSTOM_BROWSERS, if a Browser has already been defined in browsers.list, it will be ignored and not appended to the list. Only the browser category (e.g., Crawlers) can be the same for multiple custom browser definitions.
If the ENABLE_BROWSERS_LIST variable is set to True, for each log type the corresponding goaccess.conf file has the line browsers-file /goaccess-config/browsers.list appended to it enabling the use of the browsers.list file.
If a user didn't define the CUSTOM_BROWSERS variable, this will still allow them to use the default goaccess browsers list.
Note regarding Custom Log Types: Since a user may already have a browser.list file defined in their goaccess.conf file, if that is the case, their choice is respected instead of forcing them to use the file located at /goaccess-config/browsers.list. However, if they don't, but did enable the browsers list via the variable, then /goaccess-config/browsers.list is used and their custom browsers (if any defined) are appended to said file.
Documentation
I went ahead and added documentation related to these two new variables to the README
Changes
ENABLE_BROWSERS_LIST
andCUSTOM_BROWSERS
variables.start.sh
script changesbrowsers.list
(located in/goaccess/config/
) is copied to the/goaccess-config
directory. If the user defined theCUSTOM_BROWSERS
variable with a comma delimited list consisting ofBrowser:Browser_category
items, these are appended to the/goaccess-config/browsers.list
file.browsers.list
is already present in the/goaccess-config
directory at container runtime and subsequently removing it prior to copying over a fresh copy from the/goaccess/config
directory, we can ensure that thebrowsers.list
always aligns with the user'sCUSTOM_BROWSERS
variable. Since the/goaccess/config/browsers.list
file is persistent, appending to it would result in custom browsers being left behind within the file when a user removes browser(s) from theCUSTOM_BROWSERS
variable during a container restart - copying over a fresh file prior to appending custom browsers gets around this potential issue.CUSTOM_BROWSERS
, if a Browser has already been defined inbrowsers.list
, it will be ignored and not appended to the list. Only the browser category (e.g., Crawlers) can be the same for multiple custom browser definitions.custom.sh
,ncsa_combined.sh
,npm.sh
,npm_error.sh
,npm_redirection.sh
,traefik.sh
script changesENABLE_BROWSERS_LIST
variable is set to True, for each log type the correspondinggoaccess.conf
file has the linebrowsers-file /goaccess-config/browsers.list
appended to it enabling the use of thebrowsers.list
file.CUSTOM_BROWSERS
variable, this will still allow them to use the default goaccess browsers list.Note regarding Custom Log Types
: Since a user may already have abrowser.list
file defined in theirgoaccess.conf
file, if that is the case, their choice is respected instead of forcing them to use the file located at/goaccess-config/browsers.list
. However, if they don't, but did enable the browsers list via the variable, then/goaccess-config/browsers.list
is used and their custom browsers (if any defined) are appended to said file.Documentation