diff options
author | Markus Heiser <markus.heiser@darmarit.de> | 2020-04-28 16:54:42 +0200 |
---|---|---|
committer | Markus Heiser <markus.heiser@darmarit.de> | 2020-04-28 16:54:42 +0200 |
commit | 8829796f76bc74c584db1d2a83553ac0611372a0 (patch) | |
tree | c787db8b7fbc20c13f673550d4db3ede9fc173c4 /utils/morty.sh | |
parent | ea3255835a259516c7a8b62eb319a338cebf7e9f (diff) | |
download | searxng-8829796f76bc74c584db1d2a83553ac0611372a0.tar.gz searxng-8829796f76bc74c584db1d2a83553ac0611372a0.zip |
utils/morty.sh option new-key: set new morty key
A command to set new morty key in morty & searx service (settings.yml) and to
restart both services with new key::
utils/morty.sh option new-key
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Diffstat (limited to 'utils/morty.sh')
-rwxr-xr-x | utils/morty.sh | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/utils/morty.sh b/utils/morty.sh index 6b90db581..75bfeeedf 100755 --- a/utils/morty.sh +++ b/utils/morty.sh @@ -59,7 +59,7 @@ usage:: $(basename "$0") activate [service] $(basename "$0") deactivate [service] $(basename "$0") inspect [service] - $(basename "$0") option [debug-on|debug-off] + $(basename "$0") option [debug-on|debug-off|new-key] $(basename "$0") apache [install|remove] $(basename "$0") nginx [install|remove] $(basename "$0") info [searx] @@ -79,6 +79,7 @@ inspect service show service status and log option set one of the available options + :new-key: set new morty key apache : ${PUBLIC_URL_MORTY} :install: apache site with a reverse proxy (ProxyPass) :remove: apache site ${APACHE_MORTY_SITE} @@ -198,6 +199,7 @@ main() { option) sudo_or_exit case $2 in + new-key) set_new_key ;; debug-on) enable_debug ;; debug-off) disable_debug ;; *) usage "$_usage"; exit 42;; @@ -410,6 +412,23 @@ disable_debug() { set_service_env_debug false } + +set_new_key() { + rst_title "Set morty key" + echo + + MORTY_KEY="$(head -c 32 /dev/urandom | base64)" + info_msg "morty key: '${MORTY_KEY}'" + + warn_msg "this will need to reinstall services .." + MSG="${_Green}press any [${_BCyan}KEY${_Green}] to continue // stop with [${_BCyan}CTRL-C${_creset}]" wait_key + + systemd_install_service "${SERVICE_NAME}" "${SERVICE_SYSTEMD_UNIT}" + "${REPO_ROOT}/utils/searx.sh" option result-proxy "${PUBLIC_URL_MORTY}" "${MORTY_KEY}" + "${REPO_ROOT}/utils/searx.sh" option image-proxy-on +} + + install_apache_site() { rst_title "Install Apache site $APACHE_MORTY_SITE" |