up icon indicating copy to clipboard operation
up copied to clipboard

Documentation - Different environment variables per stage

Open Kisepro opened this issue 7 years ago • 4 comments

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 ?

Kisepro avatar Jun 25 '18 04:06 Kisepro

You can generate a different up.json for each, you generally don't store production and staging variables in the same file :)

kevinsimper avatar Jun 25 '18 13:06 kevinsimper

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

tj avatar Jun 25 '18 15:06 tj

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?

berkaytheunicorn avatar Feb 06 '19 12:02 berkaytheunicorn

@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

tj avatar Feb 06 '19 20:02 tj