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/searxng
from where applications can load them with theget_yaml_cfg
function.By default, customized SearXNG appl settings are expected in a file named
settings.yml
.
- searx.settings_loader.get_user_cfg_folder() Path | None [source]¶
Returns folder where the local configurations are located.
If the
SEARXNG_SETTINGS_PATH
environment 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_PATH
environment 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_PATH
points 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/searxng
exists, it is used.
In case none of the above path exists,
None
is returned. In case of environmentSEARXNG_SETTINGS_PATH
is set, but the (folder or file) does not exists, aEnvironmentError
is raised.
- 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
searx
folder of the SearXNG installation
- searx.settings_loader.load_settings(load_user_settings=True) tuple[dict, str] [source]¶
Function for loading the settings of the SearXNG application (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.