cdimascio / dotenv-java

🗝️ Dotenv is a no-dep, pure Java module that loads environment variables from a .env file
https://github.com/cdimascio/dotenv-java
Apache License 2.0
444 stars 43 forks source link

I'm curious... #24

Closed nervo closed 2 years ago

nervo commented 2 years ago

Imagine just 5 minutes that i would like to get around your strong advice to not use multiple dotenv files :) Imagine just 5 minutes that i would like to have a .env.dist overriden by an optionnal .env Just.. imagine...

How would i do ? 😘😘😘

cdimascio commented 2 years ago

@nervo you can get around this by using the file() method e.g.

String myDotenv = ".env.dist";
Dotenv dotenv = Dotenv.configure()
//    .directory("/assets") // optionally change the directory
    .filename(myDotenv);  // 
nervo commented 2 years ago

@cdimascio correct me if i'm wrong, but in the example you give, only the .env.dist file is loaded, no ?