Package io.github.cdimascio.dotenv
Class DotenvBuilder
java.lang.Object
io.github.cdimascio.dotenv.DotenvBuilder
public class DotenvBuilder extends Object
Builds and loads and
Dotenv instance.- See Also:
Dotenv.configure()
-
Constructor Summary
Constructors Constructor Description DotenvBuilder() -
Method Summary
Modifier and Type Method Description DotenvBuilderdirectory(String path)Sets the directory containing the .env file.DotenvBuilderfilename(String name)Sets the name of the .env file.DotenvBuilderignoreIfMalformed()Does not throw an exception when .env is malformed.DotenvBuilderignoreIfMissing()Does not throw an exception when .env is missing.Dotenvload()Load the contents of .env into the virtual environment.DotenvBuildersystemProperties()Sets each environment variable as system properties.
-
Constructor Details
-
DotenvBuilder
public DotenvBuilder()
-
-
Method Details
-
directory
Sets the directory containing the .env file.- Parameters:
path- the directory containing the .env file- Returns:
- this
DotenvBuilder
-
filename
Sets the name of the .env file. The default is .env.- Parameters:
name- the filename- Returns:
- this
DotenvBuilder
-
ignoreIfMissing
Does not throw an exception when .env is missing.- Returns:
- this
DotenvBuilder
-
ignoreIfMalformed
Does not throw an exception when .env is malformed.- Returns:
- this
DotenvBuilder
-
systemProperties
Sets each environment variable as system properties.- Returns:
- this
DotenvBuilder
-
load
Load the contents of .env into the virtual environment.- Returns:
- a new
Dotenvinstance - Throws:
DotenvException- when an error occurs
-