I'm querying my documents and need to get server_url from .env file, but I dont how how to get it. Please help me
If your .env file is at the root of your project, you should be able to get your variables by using process.env.YOUR_VARIABLE_NAME, ex: serverURL: process.env.PAYLOAD_URL
Does that answer your question?
Like Lou said, should be accessible via
process.env.MY_VALUE
. Ensure you're using
dotenv
to load them properly.
import dotenv from 'dotenv'
dotenv.config()
Star
Discord
online
Get help straight from the Payload team with an Enterprise License.