Commit 1963cb0f authored by Nicolas Gelot's avatar Nicolas Gelot

Expose proxy settings as env. variables

On dev mode we dont want use tor as proxy by default. With
env. variables these settings are only available on prod.
parent c7083bb3
......@@ -16,6 +16,8 @@ services:
SEARX_SECRET: ":@)%NN0+OqNdy:{prWQlZ{p9|oO9p-UyJq@%V!~G:arrSx6fXz.{jd%=XF44ncj"
SEARX_MORTY_URL: "${SPOT_MORTY_URL}"
SEARX_MORTY_KEY: "${SEARX_MORTY_KEY:-KHN0ZGluKT0gNWNmNzQ0Y2JlNjI4MDRjODAwZGUyMGY5ZjZlZTFmZWI1NTg2YTg5OAo=}"
SEARX_PROXY_HTTP: "socks5://tor:9050"
SEARX_PROXY_HTTPS: "socks5://tor:9050"
GUNICORN_LOGGER: 1
GUNICORN_LEVEL: INFO
......
......@@ -104,3 +104,7 @@ if 'SEARX_MORTY_URL' in environ:
settings.setdefault('result_proxy', {})['url'] = environ['SEARX_MORTY_URL']
if 'SEARX_MORTY_KEY' in environ:
settings.setdefault('result_proxy', {})['key'] = bytes(environ['SEARX_MORTY_KEY'], 'utf-8')
if 'SEARX_PROXY_HTTP' in environ:
settings['outgoing'].setdefault('proxies', {})['http'] = environ['SEARX_PROXY_HTTP']
if 'SEARX_PROXY_HTTPS' in environ:
settings['outgoing'].setdefault('proxies', {})['https'] = environ['SEARX_PROXY_HTTPS']
......@@ -41,9 +41,9 @@ outgoing: # communication with search engines
# uncomment below section if you want to use a proxy
# see http://docs.python-requests.org/en/latest/user/advanced/#proxies
# SOCKS proxies are also supported: see http://docs.python-requests.org/en/master/user/advanced/#socks
proxies:
http: socks5://tor:9050
https: socks5://tor:9050
# proxies :
# http : http://127.0.0.1:8080
# https: http://127.0.0.1:8080
# uncomment below section only if you have more than one network interface
# which can be the source of outgoing search requests
# source_ips:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment