mirror of
https://github.com/searxng/searxng.git
synced 2025-09-02 00:08:34 +02:00
[enh] settings unification - new dependency: pyyaml
This commit is contained in:
parent
39ebe1d519
commit
3afdd1d994
10 changed files with 150 additions and 121 deletions
|
@ -0,0 +1,22 @@
|
|||
from os import environ
|
||||
from os.path import realpath, dirname, join
|
||||
try:
|
||||
from yaml import load
|
||||
except:
|
||||
from sys import exit, stderr
|
||||
stderr.write('[E] install pyyaml\n')
|
||||
exit(2)
|
||||
|
||||
|
||||
searx_dir = realpath(dirname(realpath(__file__))+'/../')
|
||||
engine_dir = dirname(realpath(__file__))
|
||||
|
||||
if 'SEARX_SETTINGS_PATH' in environ:
|
||||
settings_path = environ['SEARX_SETTINGS_PATH']
|
||||
else:
|
||||
settings_path = join(searx_dir, 'settings.yml')
|
||||
|
||||
|
||||
with open(settings_path) as settings_yaml:
|
||||
settings = load(settings_yaml)
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue