TykTechnologies / tyk-gateway-docker

Docker compose deployment to run Tyk OSS Gateway
96 stars 80 forks source link

env_vars: entrypoint.sh overrides environment variables #16

Open asoorm opened 6 years ago

asoorm commented 6 years ago

Documentation indicates which env vars are available to set for the gateway

https://tyk.io/docs/configure/gateway-env-variables/

listen_port TYK_GW_LISTENPORT
secret TYK_GW_SECRET

However entrypoint.sh overrides these variables

export TYK_GW_LISTENPORT="$TYKLISTENPORT"
export TYK_GW_SECRET="$TYKSECRET"

Either documentation should specify that if using standard docker installation, you need to set TYKLISTENPORT and TYKSECRET rather than TYK_GW_LISTENPORT and TYK_GW_SECRET.

Or

entrypoint.sh should only set TYK_GW_LISTENPORT and TYK_GW_SECRET if they are not already set.

asoorm commented 5 years ago

Suggestion

# for backwards compatibility
if [[ -n "${TYKSECRET}" ]]; then
  export TYK_GW_SECRET="${TYKSECRET}"
fi

Then we can remove the ENV TYKSECRET 352d20ee67be67f6340b4c0605b044b7 from the Dockerfile

The problem with this suggestion is that is becomes a "magic" env var which is only available when starting container with entrypoint. as such, exec into container - the env var will not be visible.


Listen Port is significantly more difficult to fix, because that env var is used to determine which port should be exposed.