strongloop / node-foreman

A Node.js Version of Foreman
http://strongloop.github.io/node-foreman/
Other
1.27k stars 119 forks source link

Disable JSON flattening in .env #100

Closed dotchev closed 6 years ago

dotchev commented 8 years ago

For production we deploy to Cloud Foundry, but for local testing I think node-foreman could be very useful.

One thing I currently miss is the support for multiline env variables as these are heavily used in Cloud Foundry, e.g. VCAP_SERVICES

I think this will be easy to achieve by providing an option to disable JSON flattening of .env file. Instead the value of each root-level property is stringified.

Would you accept a PR for this?

rmg commented 8 years ago

@dotchev support for VCAP_SERVICES definitely sounds like a good idea to me. A PR would be great!

As a (really ugly) workaround in the meantime, you should be able to do this now by cramming it on to one line:

SOME_VAR=foo
VCAP_SERICES={"elephantsql":[{"name": "elephantsql-c6c60","credentials":{"uri":"postgres://seilbmbd:ABcdEF@babar.elephantsql.com:5432/seilbmbd"}}]}
dotchev commented 8 years ago

Meanwhile I started a new project https://github.com/dotchev/fireup. It is similar to Foreman but uses a single yml file to describe multiple processes to start, each with its own env vars, work dir, etc. YAML is very flexible and allows for multi-line values using block literals.

VCAP_SERVICES: >
  {
    "elephantsql": [
      {
        "name": "elephantsql-c6c60",
        "label": "elephantsql",
        "tags": [
          "postgres",
          "postgresql",
          "relational"
        ],
        "plan": "turtle",
        "credentials": {
          "uri": "postgres://seilbmbd:ABcdEF@babar.elephantsql.com:5432/seilbmbd"
        }
      }
    ]
  }
dytsai commented 8 years ago

Need multiline support as well. Some configuration such as certificate or private key are multiline. I haven't dig into the source but node foreman seems to take \n as \n instead of newline.

Ruby foreman support multiline with "\n" in the config string. https://github.com/ddollar/foreman/blob/master/lib/foreman/env.rb

dytsai commented 8 years ago

120 Ok, I added a pr.

stale[bot] commented 6 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.