Code Monkey home page Code Monkey logo

Comments (5)

maxbeatty avatar maxbeatty commented on May 22, 2024 1

I'd suggest using the custom path option if you know you're looking for .envrc. It's also harmless to try to attempt to load two or more files yourself.

const dotenv = require('dotenv')
dotenv.config()
dotenv.config({ path: '.envrc' })

from dotenv.

wilmoore avatar wilmoore commented on May 22, 2024 1

@adjohnson916 This should work for very specific cases where you are absolutely sure that your .envrc file only includes variable assignments; however, it could easily go south if your .envrc file includes other commands which dotenv does not support.

Also, I'm just curious to hear of other people's workflow...if you are already using direnv, why use dotenv locally at all? Shouldn't direnv allow be enough?

from dotenv.

AndersDJohnson avatar AndersDJohnson commented on May 22, 2024 1

@wilmoore I figured. Why? Might not be running the app from the current working directory, or from a different user account e.g. a system account that's not running with a shell and/or doesn't have direnv configured . Might want to use dotenv on a server to provide environment-specific configuration to the deployed application, defaulting to variables specified for local dev in .envrc via direnv.

from dotenv.

AndersDJohnson avatar AndersDJohnson commented on May 22, 2024

Thanks @maxbeatty, I'll try that.

from dotenv.

wilmoore avatar wilmoore commented on May 22, 2024

Thanks @adjohnson916 -- good to know.

from dotenv.

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.