Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/harium/dotenv
An utility tool to handle .env files in pure Java
https://github.com/harium/dotenv
dotenv java web
Last synced: about 2 months ago
JSON representation
An utility tool to handle .env files in pure Java
- Host: GitHub
- URL: https://github.com/harium/dotenv
- Owner: Harium
- License: apache-2.0
- Created: 2015-11-20T00:08:51.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2022-04-16T08:02:18.000Z (almost 3 years ago)
- Last Synced: 2023-08-12T10:56:56.549Z (over 1 year ago)
- Topics: dotenv, java, web
- Language: Java
- Homepage:
- Size: 29.3 KB
- Stars: 6
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# dotenv
[![CircleCI](https://circleci.com/gh/Harium/dotenv.svg?style=svg)](https://circleci.com/gh/Harium/dotenv)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.harium/dotenv/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.harium/dotenv/)An utility tool to handle .env files in Java.
## Maven
```com.harium
dotenv
1.0.7```
## Example
Create a .env file and place it at the root folder of your project.Get your variables using:
```java
String myValue = Env.get("MY_SECRET");
```Alternatively, you can use a custom path using the path parameter:
```java
String myValue = Env.path("/home/user/myFolder").get("MY_SECRET");
```## Fallback
If your variable is not declared in .env, dotenv will try to load it from the environment variables.## How it works
Dotenv looks for a .env file and loads it's contents. When you call
`Env.get("MY_SECRET");` for the first time, dotenv will try to load all the variables and cache them.At this repo you can find an example (.env) file: [example](https://github.com/Harium/dotenv/blob/master/.env).
## License
Apache License 2.0