#!/bin/sh set -o errexit if [ "$1" = "/usr/bin/ss-server" ]; then if [ -f "$PASSWORD_FILE" ]; then PASSWORD="$(cat "$PASSWORD_FILE")" fi if [ -f "/var/run/secrets/$PASSWORD_SECRET" ]; then PASSWORD=$(cat "/var/run/secrets/$PASSWORD_SECRET") fi ARGS="-s $SERVER_HOST -p $SERVER_PORT -k $PASSWORD \ -m $METHOD -t $TIMEOUT -u $DNS --fast-open --reuse-port \ --plugin $PLUGIN --plugin-opts $PLUGIN_OPTS $ARGS" conn_uri="$(printf 'ss://%s@%s:%s?plugin=%s#%s' \ "$(printf '%s:%s' "$METHOD" "$PASSWORD" | base64 -w 0 | tr -d =)" \ "$SERVER_IP" "$SERVER_PORT" "${PLUGIN##*/}" "$(hostname -f)")" printf '\nCONNECTION URI:\n\n%s\n\n' "$conn_uri" echo "$conn_uri" | qrencode -t ANSIUTF8 printf '\n\n' fi # shellcheck disable=SC2086 exec "$@" $ARGS