1

I'm trying to deploy a Lumen app in Elastic Beanstalk. The problem is around the .env file, of course it's gitignored, so how can I put that file into the server?

I tried to manually create the file after deploying, but the next deploy the file disappear and I have to manually recreate that file again. I don't think this is a solution....

What's the correct the way?

I tried with this solution but looks like the env variable are not being created after the deploy, so, is the only way to add directly to the AWS console?

Update

I manually added env variables through the AWS console, those variables are being displayed if I "echo" them (eg. echo $APP_ENV gives me the correct value production) but still those env variables are not being loaded in the Lumen app and ignored. Any thoughts?

miken32
  • 42,008
  • 16
  • 111
  • 154
peppeocchi
  • 814
  • 1
  • 9
  • 22
  • One correct way is do inject the variables into your applications environment in the way that you are doing so in the AWS console. By echo, do you mean from the command line? All that the dotenv package does is load your .env file and loop over each non-comment line and add to the environment via `putenv("$name=$value");` If you are able to echo `$APP_ENV` from the console then `getenv('APP_ENV')` from within PHP should return the same value. – carbontwelve Dec 16 '15 at 11:16
  • Did you get this straightened out? – niczak Mar 08 '16 at 22:14

1 Answers1

0

Updating vlucas/phpdotenv from 1.0 to 2.2 solved the issue.

peppeocchi
  • 814
  • 1
  • 9
  • 22