-
Howdy, I'm trying to finish a workflow that uses Github Actions to plonk the Payload app and its dependencies all Dockerized onto an Ubuntu box elsewhere. The last thing I seem to be struggling with is making the serverURL dynamic, as it's configured in the The way Thanks in advance, could save me more hours of headaches! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
As I understand, you need to run a |
Beta Was this translation helpful? Give feedback.
-
Hey @joshhills — Take a look at this package: https://github.com/payloadcms/nextjs-custom-server It's not quite done yet as of this writing (will be coming out later this week) and it's meant to showcase how Payload can be combined directly with a custom NextJS server which is likely different than your use case, but it shows an example for how you can use an environment variable as your There are two things to note here:
Does this give you what you need? |
Beta Was this translation helpful? Give feedback.
-
It worked! Looks like the |
Beta Was this translation helpful? Give feedback.
Hey @joshhills —
Take a look at this package:
https://github.com/payloadcms/nextjs-custom-server
It's not quite done yet as of this writing (will be coming out later this week) and it's meant to showcase how Payload can be combined directly with a custom NextJS server which is likely different than your use case, but it shows an example for how you can use an environment variable as your
serverURL
.There are two things to note here:
dotenv
in your Payload config! This will make sure that server-side code has access to your environment variables. But, it won't have any effect in the browser as there is noprocess
in the browser. As you mentioned, we mockdotenv
for the browser…