sjitech / proxy-login-automator

A single node.js script to automatically inject user/password to http proxy server via a local forwarder
MIT License
395 stars 93 forks source link

Unable to kill process using SIGTERM #26

Open neuromantik33 opened 5 years ago

neuromantik33 commented 5 years ago

Hello,

Firstly thank you for this very useful tool used with selenium + headless chrome. I'm currently running this script as a sidecar container in Kubernetes but I'm unable to gracefully shutdown the pods because the script doesn't seem to respond to SIGTERMs for shutting down. Can you confirm that this is really an issue on your end and not some incorrect script on my end? Here is my docker entrypoint

#!/usr/bin/env bash

set -e

export LOCAL_HOST=0.0.0.0
export LOCAL_PORT=${LOCAL_PORT:-8080}
export REMOTE_PORT=${REMOTE_PORT:-8080}
export AS_PAC_SERVER=${AS_PAC_SERVER:-false}
export IS_REMOTE_HTTPS=${IS_REMOTE_HTTPS:-false}
export IGNORE_HTTPS_CERT=${IGNORE_HTTPS_CERT:-false}
export ARE_REMOTES_IN_PAC_HTTPS=${ARE_REMOTES_IN_PAC_HTTPS:-false}

die () {
    echo
    echo "$*"
    echo
    exit 1
}

# Mandatory env variables
[[ -z "$REMOTE_HOST" ]] && die "Need to set REMOTE_HOST";
[[ -z "$USER" ]] && die "Need to set USER";
[[ -z "$PASSWORD" ]] && die "Need to set PASSWORD";

exec -c node /proxy-login-automator.js \
 -local_host ${LOCAL_HOST} \
 -local_port ${LOCAL_PORT} \
 -remote_host ${REMOTE_HOST} \
 -remote_port ${REMOTE_PORT} \
 -usr ${USER} \
 -pwd ${PASSWORD} \
 -as_pac_server ${AS_PAC_SERVER} \
 -is_remote_https ${IS_REMOTE_HTTPS} \
 -ignore_https_cert ${IGNORE_HTTPS_CERT} \
 -are_remotes_in_pac_https ${ARE_REMOTES_IN_PAC_HTTPS}

Thanks for any help regarding the matter :)