1
0
mirror of https://github.com/searxng/searxng.git synced 2024-11-22 04:01:40 +01:00

[enh] optionally configurable hostname - edit settings.py

This commit is contained in:
asciimoo 2013-12-26 01:53:26 +01:00
parent fd6e730d50
commit 141b04c6dd
2 changed files with 7 additions and 1 deletions

View File

@ -12,3 +12,5 @@ weights = {} # 'search_engine_name': float(weight) | default is 1.0
blacklist = [] # search engine blacklist
categories = {} # custom search engine categories
hostname = None # domain name or None - if you want to rewrite the default HTTP host

View File

@ -165,7 +165,11 @@ def opensearch():
method = 'get'
if request.is_secure:
scheme = 'https'
ret = opensearch_xml.format(method=method, host=url_for('index', _external=True, _scheme=scheme))
if settings.hostname:
hostname = '{0}://{1}/'.format(scheme,settings.hostname)
else:
hostname = url_for('index', _external=True, _scheme=scheme)
ret = opensearch_xml.format(method=method, host=hostname)
resp = Response(response=ret,
status=200,
mimetype="application/xml")