Skip to content
Advertisement

TYK Dashboard and Gateway Environment Variables Usage

i’m using licensed version of TYK Dashboard .So i need the change configuration of TYK Configs.

So at this link at the here https://tyk.io/docs/configure/dashboard-env-variables/ I’ve wanted to use environment variables at launch time of VM .

But these are not working on my machine (on-premis). I could not find the mistake in my approach .Please help .

My script is shown at below .

 export TYK_DB_LICENSEKEY=$LICENSE_KEY 
 export TYK_DB_MONGOUSESSL=$MONGOUSESSL

 sudo /opt/tyk-dashboard/install/setup.sh --listenport=3000 --redishost=$REDIS_HOST --redisport=6379 --tyk_api_hostname=$HOSTNAME --tyk_node_hostname=http://localhost --tyk_node_port=8080 --portal_root=/portal --domain="XXX.XXX.XXX.XXX"

At least I can handle the mongo url but LICENSE KEY parameter has no sign anywhere.

Please Help ME !

Advertisement

Answer

install/setup.sh simply sets up some sensible defaults inside your tyk_analytics.conf file.

You can either edit the /opt/tyk-dashboard/tyk_analytics.conf directly, and insert your license key in there. Then restart the dashboard service systemctl restart tyk-dashboard.

Alternatively, if you want to use environment variables, you need to set them globally on the machine, or in your tyk-dashboard systemd unit file.

edit /lib/systemd/system/tyk-dashboard.service

Add your environment variable inside the [Service] directive

Environment="TYK_DB_LICENSEKEY=FOOBARBAZ"

save & quit, then

systemctl daemon-reload
systemctl restart tyk-dashboard

More comprehensive answer here: https://serverfault.com/questions/413397/how-to-set-environment-variable-in-systemd-service

Advertisement