From 3afdd1d9941527e23cd7c05d2c15dd24a32de834 Mon Sep 17 00:00:00 2001 From: asciimoo Date: Sun, 19 Jan 2014 00:17:02 +0100 Subject: [enh] settings unification - new dependency: pyyaml --- searx/__init__.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'searx/__init__.py') diff --git a/searx/__init__.py b/searx/__init__.py index e69de29bb..e313306e3 100644 --- a/searx/__init__.py +++ b/searx/__init__.py @@ -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) + -- cgit v1.2.3