Skip to content

env_vars: entrypoint.sh overrides environment variables #16

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
asoorm opened this issue Aug 17, 2018 · 1 comment
Open

env_vars: entrypoint.sh overrides environment variables #16

asoorm opened this issue Aug 17, 2018 · 1 comment

Comments

@asoorm
Copy link
Member

asoorm commented Aug 17, 2018

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
Copy link
Member Author

asoorm commented Jan 25, 2019

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.

asoorm added a commit to asoorm/tyk-gateway-docker that referenced this issue Jan 25, 2019
Addresses: TykTechnologies#16

In order to not introduce breaking changes, legacy `TYKSECRET` takes
precedence.

If `TYK_GW_SECRET` is not set, then we need to hardcode the secret to
ensure no issues if is missing from `tyk.conf`.
asoorm added a commit to asoorm/tyk-gateway-docker that referenced this issue Jan 25, 2019
Addresses: TykTechnologies#16

Allow TYK_GW_SECRET to be used to set the secret in gateway.

In order to not introduce breaking changes, legacy `TYKSECRET` takes
precedence.

If `TYK_GW_SECRET` is not set, then we need to hardcode the secret to
ensure no issues if is missing from `tyk.conf`.
alephnull pushed a commit that referenced this issue Jun 26, 2019
Addresses: #16

Allow TYK_GW_SECRET to be used to set the secret in gateway.

In order to not introduce breaking changes, legacy `TYKSECRET` takes
precedence.

If `TYK_GW_SECRET` is not set, then we need to hardcode the secret to
ensure no issues if is missing from `tyk.conf`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant