on master help sign in
[enh] optionally configurable hostname - edit settings.py
commit141b04c6dde9df0e6b7f2e2b30ec8131429c8932 authorasciimoo <asciimoo@gmail.com> dateThu 26 Dec 2013, 01:53 (13 years ago) parentfd6e730
2 files changed+7−1
searx/settings.py+2 searx/webapp.py+5−1
searx/settings.py+2
@@ -12,3 +12,5 @@ weights = {} # 'search_engine_name': float(weight) | default is 1.0
1212blacklist = [] # search engine blacklist
1313
1414categories = {} # custom search engine categories
15+
16+hostname = None # domain name or None - if you want to rewrite the default HTTP host
searx/webapp.py+5−1
@@ -165,7 +165,11 @@ def opensearch():
165165 method = 'get'
166166 if request.is_secure:
167167 scheme = 'https'
168− ret = opensearch_xml.format(method=method, host=url_for('index', _external=True, _scheme=scheme))
168+ if settings.hostname:
169+ hostname = '{0}://{1}/'.format(scheme,settings.hostname)
170+ else:
171+ hostname = url_for('index', _external=True, _scheme=scheme)
172+ ret = opensearch_xml.format(method=method, host=hostname)
169173 resp = Response(response=ret,
170174 status=200,
171175 mimetype="application/xml")