How can be set a secret token to use it in javascript routes without submitting it to GIT repo?
Something like
L.tileLayer('https://api.mapbox.com/styles/v1/mapbox/streets-v11/tiles/{z}/{x}/{y}?access_token={{MY_TOKEN}}'
Thanks!
How can be set a secret token to use it in javascript routes without submitting it to GIT repo?
Something like
L.tileLayer('https://api.mapbox.com/styles/v1/mapbox/streets-v11/tiles/{z}/{x}/{y}?access_token={{MY_TOKEN}}'
Thanks!
For secrets like ACF PRO key, Google Maps key and others I use for development the .env
file and for Trellis the vault.yml
.
Yes, thank you. I’m not sure if my question is right. With .env
variables I can make them available to PHP, not for JS. Isn’t it?
You can get the environment variable and pass it as JavaScript variable either in the theme or in a pugin.
This topic was automatically closed after 42 days. New replies are no longer allowed.