This project strongly inspired by dotenv-java which is a great tool, and is practically the only existing library
that provides the ability to work with .env files conveniently.
However, there are several aspects that could be improved:
- reading of the
.envfiles implemented via manual parsing, which could be considered as simple.propertiesallowing to use existingjava.util.Propertiesinstead of any manual work - dotenv-java cannot resolve references between properties
In other words, instead of reimplementing bicycle and parsing .env file manually using regular expressions, etc., it's
loaded just like the usual .properties file. In my implementation, I tried to concentrate on the functionality that,
in my opinion, is exactly what is missing - resolving references.
Consider for example a file with the following content:
A=1
B=2
C=3
D=${A} ${B} ${C}Trying to get property D will lead to value 1 2 3 be resolved.
Here you can find the instructions for installing the library using various build systems.
-
Add Jitpack repository to your repositories list
repositories { // ...other repositories you use... maven { url 'https://jitpack.io' } } -
Add library dependency to you dependencies list
dependencies { implementation 'com.github.arhor:java-dotenv-revised:0.1.5' }
-
Add Jitpack repository to your repositories list
<repositories> <!-- ...other repositories you use... --> <repository> <id>jitpack.io</id> <url>https://jitpack.io</url> </repository> </repositories>
-
Add library dependency to you dependencies list
<dependency> <groupId>com.github.arhor</groupId> <artifactId>java-dotenv-revised</artifactId> <version>0.1.5</version> </dependency>