I want to pass
process.env.PAYLOAD_PUBLIC_NON_SENSITIVE_KEYto a custom field component because
process.env === {}on the admin panel.
I've tried to convert my collection file to
.tsxbut cannot pass an instantiated component directly
Anyone know if I can pass my own props to this component? Or some other way to access
process.env.PAYLOAD_PUBLIC_NON_SENSITIVE_KEY?
Ended up just hardcoding the non-sensitive key as an
export const ...instead of trying to use it through
process.envHey
@946299884070375424apologies for not getting back to you sooner but we're glad you found a solution!
you should be able to access envs prefixed with PAYLOAD_PUBLIC. Are you setting up dotenv in your payload config and server file?
Hey
@281120856527077378, my
server.tslooks like
import cookieParser from 'cookie-parser';
import cors from 'cors';
import dotenv from 'dotenv';
import express from 'express';
import payload from 'payload';
dotenv.config();
// ...internal imports
// ...rest of fileand my
payload.config.tslooks very similar
import path from 'path';
// ...external lib imports e.g. from 'payload'
dotenv.config();
// ...internal imports
// ...rest of fileStar
Discord
online
Get dedicated engineering support directly from the Payload team.