1

I'm having issues deploying to Now with node-config custom env vars.

Now does not deploy my custom-environment-variables.json file, but I am able to import it and print it to the console. Is there a way to pass this object to node-config so it makes use of the env vars I have specified?

styfle
  • 22,361
  • 27
  • 86
  • 128
Eliezer Steinbock
  • 4,728
  • 5
  • 31
  • 43
  • 1
    I don't know much about `node-config`, but if you need to set environment variables, you can add them to your `now.json` file. Any secrets such as passwords should use `now secrets`. See the docs here: https://zeit.co/docs/v2/deployments/environment-variables-and-secrets – styfle May 23 '19 at 12:15

2 Answers2

0

So for my specific question there isn't a way to do it. This is the code relating to it: https://github.com/lorenwest/node-config/blob/master/lib/config.js#L1216

To deploy with Now v2 there may be a solution. Still searching.

Eliezer Steinbock
  • 4,728
  • 5
  • 31
  • 43
0

I'm a maintainer of node-config. The custom-environment-variables.json file should be deployed and the environment variables mentioned in there should be set in the environment before node-config is loaded.

Mark Stosberg
  • 12,961
  • 6
  • 44
  • 49
  • Appreciate the response Mark. Not sure how much that helps getting things working with Now v2 though? For now I've stopped using now however. – Eliezer Steinbock Mar 25 '19 at 21:18