https://linen.dev logo
Best way to have different url for local developme...
# help
b
I was wondering what is the best way of going about having different urls for local development and production. At this point in time this is mostly for specifying cors policy, so when running locally I will allow through http://localhost but then switch out to my front-end host url when deploying to rocket. In my NextJs front-end host this is done with a
env.development
, and an
.env.production
which both specify an
API_URL
variable. What would the equivalent here be? Thanks 😄
a
Hey there! 🙂 Normally for domain stuff I usually just use
//${windows.location.host}/api/whatever-you-want-here
as it supports both http/https on the frontend side (and afaik works regardless of whether in dev or prod) then for the backend if we're trying to make a cors layer or something, typically I store them as secrets in Secrets.toml using the shuttle-secrets crate: https://docs.shuttle.rs/resources/shuttle-secrets
If you need dev-specific secrets, normally what I do is make a
Secrets.dev.toml
file (which the deployer will know to prioritise over
Secrets.toml
if you are in dev) and then copy over whatever secrets I need that are shared between both then just change whatever I need in the
Secrets.dev.toml
file
b
ah sweet thanks I'll give this a go!