Environment Variables in Admin UI
Admin environment vars
By default, env
variables are not provided to the Admin panel for security and safety reasons.
But, Payload provides you with a way to still provide env
vars to your frontend code.
Payload will automatically supply any present env
variables that are prefixed with PAYLOAD_PUBLIC_
directly to the Admin panel.
For example, if you've got the following environment variable:
PAYLOAD_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_test_XXXXXXXXXXXXXXXXXX
This key will automatically be made available to the Payload bundle and can be referenced in your Admin component code as process.env.PAYLOAD_PUBLIC_STRIPE_PUBLISHABLE_KEY
.
Next