diff options
| author | Adam Tauber <asciimoo@gmail.com> | 2014-10-19 12:06:34 +0200 |
|---|---|---|
| committer | Adam Tauber <asciimoo@gmail.com> | 2014-10-19 12:06:34 +0200 |
| commit | 20400c40c34b6122621476c46460c5a3a8624c89 (patch) | |
| tree | aa598d3d8b09f489b8d96a1821e7a560b8019672 /searx/__init__.py | |
| parent | 840945f498cd07d38cb198cc0735b6445f44802c (diff) | |
| parent | 1e3e6465845236b027ce8df9ab5fcc78ffe3f1d1 (diff) | |
Merge pull request #97 from pointhi/https
Implementing https rewrite support
Diffstat (limited to 'searx/__init__.py')
| -rw-r--r-- | searx/__init__.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/searx/__init__.py b/searx/__init__.py index 17da2f353..c4c363bf8 100644 --- a/searx/__init__.py +++ b/searx/__init__.py @@ -17,6 +17,7 @@ along with searx. If not, see < http://www.gnu.org/licenses/ >. from os import environ from os.path import realpath, dirname, join, abspath +from searx.https_rewrite import load_https_rules try: from yaml import load except: @@ -34,7 +35,16 @@ if 'SEARX_SETTINGS_PATH' in environ: else: settings_path = join(searx_dir, 'settings.yml') +if 'SEARX_HTTPS_REWRITE_PATH' in environ: + https_rewrite_path = environ['SEARX_HTTPS_REWRITE_PATH'] +else: + https_rewrite_path = join(searx_dir, 'https_rules') # load settings with open(settings_path) as settings_yaml: settings = load(settings_yaml) + +# load https rules only if https rewrite is enabled +if settings.get('server', {}).get('https_rewrite'): + # loade https rules + load_https_rules(https_rewrite_path) |