summaryrefslogtreecommitdiff
path: root/searx/__init__.py
diff options
context:
space:
mode:
authorasciimoo <asciimoo@gmail.com>2014-01-19 00:17:02 +0100
committerasciimoo <asciimoo@gmail.com>2014-01-19 00:17:02 +0100
commit3afdd1d9941527e23cd7c05d2c15dd24a32de834 (patch)
tree4bc85cba1b0784e1528ef0d235562201e4f0c437 /searx/__init__.py
parent39ebe1d5193bf62340bc101d51cab77df3c06f7e (diff)
downloadsearxng-3afdd1d9941527e23cd7c05d2c15dd24a32de834.tar.gz
searxng-3afdd1d9941527e23cd7c05d2c15dd24a32de834.zip
[enh] settings unification - new dependency: pyyaml
Diffstat (limited to 'searx/__init__.py')
-rw-r--r--searx/__init__.py22
1 files changed, 22 insertions, 0 deletions
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)
+