diff --git a/roles/searx/defaults/main.yml b/roles/searx/defaults/main.yml index 0165f48..de1cc15 100644 --- a/roles/searx/defaults/main.yml +++ b/roles/searx/defaults/main.yml @@ -8,3 +8,7 @@ searx_use_https: true # the subdomain link searx will be reachable under subdomain_alias: search + +searx_authentication: + - username: mysearxusername + password: JDJhJDE0JFdjUnQ5WWllcU8wa01xS0JBS2dlMy5zMEhRTmxqTXdIZmdjcTN6ZGFwRjJlYUdoSHAwRUhL # mysearxpassword diff --git a/roles/searx/templates/upstream.json.j2 b/roles/searx/templates/upstream.json.j2 index 9966f1a..12fd8f0 100644 --- a/roles/searx/templates/upstream.json.j2 +++ b/roles/searx/templates/upstream.json.j2 @@ -26,6 +26,21 @@ ], {% endif %} "handle": [ +{% if searx_authentication is not undefined and not none %} + { + "handler": "authentication", + "providers": { + "http_basic": { + "accounts": [ + { + "username": "{{ searx_authentication.username }}", + "password": "{{ searx_authentication.password }}" + } + ] + } + } + }, +{% endif %} { "handler": "reverse_proxy", "upstreams": [