Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where to put "useDotenv: true" in serverless.yml file?

I was using serverless templates and all worked fine until suddenly all my deployments started ignoring .env files.

I searched through the documentation and it says that if I want to use the environment variables from .env files I now have to add useDotenv: true in my serverless.yml file. So I did:

app: xxx
org: xxx
useDotenv: true 

There was no effect.

My serverless.yml file contained nothing else before but the app and org variables.

Where do I need to add the seDotenv: true in order to make it read my .env variables?

like image 840
Smlok Avatar asked Feb 18 '21 05:02

Smlok


1 Answers

You should put it at the root of your serverless.yml file.

I have mine just after the service attribute :

service: lb-courses
useDotenv: true
plugins:
  - serverless-offline
...
like image 174
Eric Dofonsou Avatar answered Oct 05 '22 00:10

Eric Dofonsou