Settings Loader¶
Implementations for loading configurations from YAML files. This essentially
includes the configuration of the (SearXNG appl)
server. The default configuration for the application server is loaded from the
DEFAULT_SETTINGS_FILE. This default
configuration can be completely replaced or customized individually and the SEARXNG_SETTINGS_PATH environment
variable can be used to set the location from which the local customizations are
to be loaded. The rules used for this can be found in the
get_user_cfg_folder function.
By default, local configurations are expected in folder
/etc/searxngfrom where applications can load them with theget_yaml_cfgfunction.By default, customized SearXNG appl settings are expected in a file named
settings.yml.
- searx.settings_loader.DEFAULT_SETTINGS_FILE = PosixPath('/home/runner/work/searxng/searxng/searx/settings.yml')¶
The git://searx/settings.yml file with all the default settings.
- searx.settings_loader.get_yaml_cfg(file_name: str | Path) dict[source]¶
Shortcut to load a YAML config from a file, located in the
in the
searxfolder of the SearXNG installation
- searx.settings_loader.get_user_cfg_folder() Path | None[source]¶
Returns folder where the local configurations are located.
If the
SEARXNG_SETTINGS_PATHenvironment is set and points to a folder (e.g./etc/mysxng/), all local configurations are expected in this folder. The settings of the SearXNG appl then expected insettings.yml(e.g./etc/mysxng/settings.yml).If the
SEARXNG_SETTINGS_PATHenvironment is set and points to a file (e.g./etc/mysxng/myinstance.yml), this file contains the settings of the SearXNG appl and the folder (e.g./etc/mysxng/) is used for all other configurations.This type (
SEARXNG_SETTINGS_PATHpoints to a file) is suitable for use cases in which different profiles of the SearXNG appl are to be managed, such as in test scenarios.If folder
/etc/searxngexists, it is used.
In case none of the above path exists,
Noneis returned. In case of environmentSEARXNG_SETTINGS_PATHis set, but the (folder or file) does not exists, aEnvironmentErroris raised.