paulschwarz/spring-dotenv

Add support the Dotenv configuration options

Closed this issue · 8 comments

I'd like this library to have support for Dotenv configuration options: https://github.com/cdimascio/dotenv-java#configuration-options

So I'd like to be able to change the 'directory' and 'filename'

Thanks

I don't mind the idea, however there are a few questions I'd like to ask you.

  1. have you run into a case where it's not sufficient to rely on the default locations of project root and resources root?
  2. have you run into a case where the default name .env is not sufficient?
  3. how do you propose to configure the Dotenv loading without confusing the user?

Discussion

Question 1: So far, in my projects I've never come across a need to specify a different directory. Are you sure you're using the library/concept correctly?

Question 2: I have seen some frameworks leverage different profiles like .env.testing but I'm nervous that if we allow that, people will revert to profile-based environments which goes against 12factor app's explanation of Config.

Question 3: How to make sure we don't create configurationception?

Thoughts? Proposal? PR?

I don't mind the idea, however there are a few questions I'd like to ask you.

  1. have you run into a case where it's not sufficient to rely on the default locations of project root and resources root?
  2. have you run into a case where the default name .env is not sufficient?
  3. how do you propose to configure the Dotenv loading without confusing the user?

Discussion

Question 1: So far, in my projects I've never come across a need to specify a different directory. Are you sure you're using the library/concept correctly?

Question 2: I have seen some frameworks leverage different profiles like .env.testing but I'm nervous that if we allow that, people will revert to profile-based environments which goes against 12factor app's explanation of Config.

Question 3: How to make sure we don't create configurationception?

Thoughts? Proposal? PR?

  1. No, simply wanted to put into a different directory like /env and then put different files there like .env.local .env.dev, but then this relates to point number 2 which is not what this is meant for, so all good 👍

P.S. I just started using this library today :)

  1. I thought by having defaults, as it is without specifying those!

Thanks for your reply and clarification :)

Any plans to implement this? We have the following case:
A monorepo multi-module project which has several application each in different module

.
application1
application1/.env
application1/.env.test
application2
application2/.env
application2/.env.test

Each of this sub-modules are started separately. env.test is used in during our tests

@petromir @durimkryeziu would anyone mind submitting a PR? I believe that it makes sense to allow the library to be configured. At first I was just hesitant because it looks like it would descend into users creating multi-tier env files.

I personally don't mind to wait for your solution once you return from vacation 😉

@durimkryeziu @petromir thanks for your patience. I released v2.4.0 today. Please see the section on configuration https://github.com/paulschwarz/spring-dotenv#configuration-optional

Looking forward to hearing your feedback.

@paulschwarz do you have an example of how to write configuration in .properties file? Thanks