From 7fefb18bcbda8b73e1573734552e342788c44386 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 19 Dec 2016 22:03:41 +0000 Subject: [PATCH] onion domain --- src/freedombone-app-turtl | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/freedombone-app-turtl b/src/freedombone-app-turtl index 72f52b10..1b0ffd52 100755 --- a/src/freedombone-app-turtl +++ b/src/freedombone-app-turtl @@ -296,8 +296,13 @@ function turtl_setup { BINDADDR=${BINDADDR:-0.0.0.0} BINDPORT=${BINDPORT:-8181} PROD_ERR_HANDLING=${PROD_ERR_HANDLING:-t} - FQDN=${FQDN:-$TURTL_API_DOMAIN_NAME} - SITE_URL=${SITE_URL:-https://$TURTL_API_DOMAIN_NAME} + if [[ $ONION_ONLY == 'no' ]]; then + FQDN=${FQDN:-$TURTL_API_DOMAIN_NAME} + SITE_URL=${SITE_URL:-https://$TURTL_API_DOMAIN_NAME} + else + FQDN=${FQDN:-$TURTL_API_ONION_HOSTNAME} + SITE_URL=${SITE_URL:-http://$TURTL_API_ONION_HOSTNAME} + fi ADMIN_EMAIL=${ADMIN_EMAIL:-$MY_USERNAME@$DEFAULT_DOMAIN_NAME} EMAIL_FROM=${EMAIL_FROM:-noreply@$DEFAULT_DOMAIN_NAME} SMTP_USER=${SMTP_USER:-} @@ -305,7 +310,11 @@ function turtl_setup { DISPLAY_ERRORS=${DISPLAY_ERRORS:-t} DEFAULT_STORAGE_LIMIT=${DEFAULT_STORAGE_LIMIT:-100} STORAGE_INVITE_CREDIT=${STORAGE_INVITE_CREDIT:-25} - LOCAL_UPLOAD_URL=${LOCAL_UPLOAD_URL:-https://$TURTL_API_DOMAIN_NAME} + if [[ $ONION_ONLY == 'no' ]]; then + LOCAL_UPLOAD_URL=${LOCAL_UPLOAD_URL:-https://$TURTL_API_DOMAIN_NAME} + else + LOCAL_UPLOAD_URL=${LOCAL_UPLOAD_URL:-http://$TURTL_API_ONION_HOSTNAME} + fi LOCAL_UPLOAD_PATH=${LOCAL_UPLOAD_PATH:-"$TURTL_BASE_DIR/data"} AWS_S3_TOKEN=${AWS_S3_TOKEN:-(:token '' :secret '' @@ -529,12 +538,12 @@ __ENDCONFIG__ echo "(pushnew \"./\" asdf:*central-registry* :test #'equal)" >> $TURTL_BASE_DIR/api/launch.lisp echo '(load "start")' >> $TURTL_BASE_DIR/api/launch.lisp + TURTL_API_ONION_HOSTNAME=$(add_onion_service turtlapi 80 ${TURTL_API_ONION_PORT}) + turtl_setup } function install_turtl_nginx { - TURTL_API_ONION_HOSTNAME=$(add_onion_service turtlapi 80 ${TURTL_API_ONION_PORT}) - turtl_nginx_site=/etc/nginx/sites-available/$TURTL_API_DOMAIN_NAME if [[ $ONION_ONLY == "no" ]]; then function_check nginx_http_redirect