Environment Variables- Env() not working in production?

#1

Hey all,

I feel like I’m missing something really obvious, but I’m not sure what it is.

Adonis.Env() isn’t working once deployed to my dev servers. I’m disabling .env as the docs say to:

ENV_SILENT=true node server.js

But now the following code doesn’t work:
const Env = use(“Env”);
var someEnv = Env.get(“SOME_ENV”); // returns undefined


I know I have my variables properly set on the server. Does Env() only work with .env file?
0 Likes

#2

Do you see your environment variables when you log process.env?

0 Likes

#3

Ya, they’re all npm related variables. I uploaded to EC2 via ELB and in .ebextensions, I passed all of my env variables.

option_settings:
  aws:elasticbeanstalk:application:environment:
    DB_HOST: hostname

The environment variables uploaded correctly, as they show in the UI config settings after deployment. However, the only env variables showing are the npm vars.

0 Likes