up
up copied to clipboard
Documentation - Different environment variables per stage
Hello,
It seems to have been done in the #353 but I don't see it in the documentation and I tried several things but not successful.
What I tried :
"stages": {
"staging": {
"ENDPOINT": "http://dev.com",
"environment": {
"ENDPOINT": "http://dev.com"
}
}
Do someone have a clue ? :-) Maybe it's only implemented for UP PRO ?
You can generate a different up.json for each, you generally don't store production and staging variables in the same file :)
Up Pro has stage-specific env vars, for example up env set ENDPOINT --stage production. In general it's insecure to keep them in your up.json, but that works fine for side projects of course :D
I tried different solutions, but I guess I need a little help on the same issue.
Let's say it is ok to keep secrets in up.json.
I try to create up.json for stating and up.production.json for production but deployment still uses up.json environment properties.
I also tried same thing in the question.
Still no luck. @tj can you give us a little more detail?
@berkaey there isn't really a way to do it with the free OSS version, but the pro version has up env, for example:
Add multiple variables.
$ up env add FOO=bar BAR=baz
Add a production env variable.
$ up env add MONGO_URL="mongodb://db1.example.net:2500/" -s production
Add a staging env variable.
$ up env add MONGO_URL="mongodb://db2.example.net:2500/" -s staging