@wpackio/scripts can handle custom env variables from
.envfile at the root of your project.
All variables starting with
WPAKCIO_ will be available in your application
code without the
WPACKIO_ prefix. So if you have
WPACKIO_SECRET_KEY in your
env, then you can access it from your app by
Start by creating a
.env (note the leading dot) file at the root of your
project. Now paste the following content in it
The above values would be available through
process.env.SENDY_PUBLIC_KEY. The prefix
WPACKIO_ is automatically
stripped in application code.
const stripeSdk = Stripe(process.env.STRIPE_PUBLIC_KEY); const elements = stripeSdk.elements();
Anything in the
envwhich does not start with
WPACKIO_is ignored. This is made this way to prevent leaking sensitive credentials to the app.