mirror of
https://github.com/searxng/searxng.git
synced 2024-12-23 09:46:31 +00:00
[enh] optionally configurable hostname - edit settings.py
This commit is contained in:
parent
fd6e730d50
commit
141b04c6dd
2 changed files with 7 additions and 1 deletions
|
@ -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
|
||||
|
|
|
@ -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")
|
||||
|
|
Loading…
Reference in a new issue