Giter Club home page Giter Club logo

Comments (9)

colynb avatar colynb commented on July 27, 2024

I appreciate the PR. I'll evaluate it hopefully this week. The issue I was trying to solve that others were having an issue with, is the ability to use env vars in the provider section of the yaml. Other users were trying to use provider details like "stage" to dynamically load the proper env file (e.g. .env.dev). I don't think it's logically possible to do both. Is that something you would be able to help with?

from serverless-dotenv-plugin.

naturalethic avatar naturalethic commented on July 27, 2024

I was trying to do the same thing you mentioned, resolve .etc file location based on stage.

I don't think it's possible to do both. It would require resolving certain variables first (the stage), then the .etc variables, then all the rest. I don't think there is any mechanism for this in the architecture.

I think people will just have to settle with a single .etc file and swap them around outside of serverless by some other mechanism.

from serverless-dotenv-plugin.

naturalethic avatar naturalethic commented on July 27, 2024

You can toss this PR, and close the associated ticket.

from serverless-dotenv-plugin.

naturalethic avatar naturalethic commented on July 27, 2024

Also I'd remove the file selection mechanism in the custom config and the docs.

from serverless-dotenv-plugin.

colynb avatar colynb commented on July 27, 2024

I didn't notice that in the README. It's removed now. Thanks!

from serverless-dotenv-plugin.

colynb avatar colynb commented on July 27, 2024

@naturalethic I figured out a solution for which I will be adding a fix for shortly. When you run the deploy command sls deploy you can provide the stage as an option: sls deploy --stage dev. All CLI options get passed into the plugin. I can use that option to dynamically determine the env file name automatically.

from serverless-dotenv-plugin.

colynb avatar colynb commented on July 27, 2024

@naturalethic I've updated the plugin so that it resolves files names based on what NODE_ENV is set to, instead of what stage is set to. See https://github.com/infrontlabs/serverless-dotenv-plugin#automatic-env-file-name-resolution

Note, I have not published this to NPM yet. I want to do some more testing but you can pull the latest from master branch to test it out.

from serverless-dotenv-plugin.

naturalethic avatar naturalethic commented on July 27, 2024

I like the solution. However, it is unclear by the documentation if .env or .env.development is the default when NODE_ENV is unset.

from serverless-dotenv-plugin.

colynb avatar colynb commented on July 27, 2024

@naturalethic I updated the README to be more clear.

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.