Giter Club home page Giter Club logo

Comments (8)

colynb avatar colynb commented on July 27, 2024 3

I'll see what I can do

from serverless-dotenv-plugin.

schickling avatar schickling commented on July 27, 2024 1

I've tried to solve it like this

custom:
  envfile:
    dev: .env
    prod: .env.prod
  dotenv:
    path: ${self:custom.envfile.${opt:stage, 'dev'}}

Unfortunately, this plugin doesn't seem to resolve the var syntax.

from serverless-dotenv-plugin.

andidev avatar andidev commented on July 27, 2024 1

thanks, that works great!

from serverless-dotenv-plugin.

schickling avatar schickling commented on July 27, 2024

Thanks a lot @colynb! Highly appreciated!

from serverless-dotenv-plugin.

colynb avatar colynb commented on July 27, 2024

this has been resolved with #6

from serverless-dotenv-plugin.

rapkyt avatar rapkyt commented on July 27, 2024

Has this been reversed? I can't use path: .env.${opt:stage} on version 2.3.2

from serverless-dotenv-plugin.

andidev avatar andidev commented on July 27, 2024

@rapkyt for some reason path does not support variables.
for example this works for me:

path: .env.dev

but this does not

path: .env.${'dev'}

from serverless-dotenv-plugin.

rapkyt avatar rapkyt commented on July 27, 2024

@andidev
I don't know what happened before that I couldn't get a file per environment, but now I've put all my env files I.e. .env.dev, .env.prod, inside a folder called config and this setting did the trick

config:
  dotenv:
    basePath: config/

Also I run all serverless comamnds passing stage and env variables, i.e.:

serverless deploy --stage {env_name} --env {env_name}

from serverless-dotenv-plugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.