-
-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
85 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
{ | ||
"name": "cdimascio/java-dotenv", | ||
"version": "0.1.4", | ||
"libraries": { | ||
"xv": "^1.1.25" | ||
}, | ||
"title": "", | ||
"branch": "", | ||
"style": { | ||
"name": "Material", | ||
"componentSet": { | ||
"nav": "nav/DarkAbsoluteNav", | ||
"header": "header/GradientHeader", | ||
"article": "article/BasicArticle", | ||
"footer": "footer/BasicFooter" | ||
}, | ||
"fontFamily": "Roboto, sans-serif", | ||
"heading": { | ||
"fontWeight": 500, | ||
"letterSpacing": "-0.01em" | ||
}, | ||
"colors": { | ||
"text": "#212121", | ||
"background": "#fff", | ||
"primary": "#2196f3", | ||
"secondary": "#1565c0", | ||
"highlight": "#ff4081", | ||
"border": "#e0e0e0", | ||
"muted": "#f5f5f5" | ||
}, | ||
"layout": { | ||
"centered": true, | ||
"bannerHeight": "80vh", | ||
"maxWidth": 896 | ||
} | ||
}, | ||
"content": [ | ||
{ | ||
"component": "nav", | ||
"links": [ | ||
{ | ||
"href": "https://github.com/cdimascio/java-dotenv", | ||
"text": "GitHub" | ||
} | ||
] | ||
}, | ||
{ | ||
"component": "header", | ||
"heading": "java-dotenv", | ||
"subhead": "Dotenv is a zero-dependency module that loads environment variables from a .env", | ||
"children": [ | ||
{ | ||
"component": "ui/TweetButton", | ||
"text": "java-dotenv: Dotenv is a zero-dependency module that loads environment variables from a .env", | ||
"url": "" | ||
}, | ||
{ | ||
"component": "ui/GithubButton", | ||
"user": "cdimascio", | ||
"repo": "java-dotenv" | ||
} | ||
] | ||
}, | ||
{ | ||
"component": "article", | ||
"metadata": { | ||
"source": "github.readme" | ||
}, | ||
"html": "\n<p><img src=\"https://img.shields.io/badge/build-passing-green.svg\"><img src=\"https://img.shields.io/badge/tests-passing-green.svg\"> <img src=\"https://img.shields.io/badge/license-Apache%202.0-blue.svg\"></p>\n<p><img src=\"https://raw.githubusercontent.com/cdimascio/java-dotenv/master/assets/java-dotenv.png\"> </p>\n<p>Dotenv is a zero-dependency module that loads environment variables from a <code>.env</code>. Storing configuration in the environment separate from code is based on The <a href=\"http://12factor.net/config\">The Twelve-Factor App</a> methodology.</p>\n<p><strong>Note:</strong> Java does not provide a way to set environment variables on a currently running process. Thus, once <code>java-dotenv</code> is configured, you can use the <code>dotenv.get("...")</code> API to get environment variables, instead of <code>System.getenv(...)</code>. <code>dotenv</code> should be used to retrieve all environment variables. Those listed in <code>.env</code> will override those in the the environment. </p>\n<h2>Install</h2>\n<h3>Maven</h3>\n<pre><span class=\"hljs-tag\"><<span class=\"hljs-name\">dependency</span>></span>\n <span class=\"hljs-tag\"><<span class=\"hljs-name\">groupId</span>></span>io.github.cdimascio<span class=\"hljs-tag\"></<span class=\"hljs-name\">groupId</span>></span>\n <span class=\"hljs-tag\"><<span class=\"hljs-name\">artifactId</span>></span>java-dotenv<span class=\"hljs-tag\"></<span class=\"hljs-name\">artifactId</span>></span>\n <span class=\"hljs-tag\"><<span class=\"hljs-name\">version</span>></span>1.1.0<span class=\"hljs-tag\"></<span class=\"hljs-name\">version</span>></span>\n<span class=\"hljs-tag\"></<span class=\"hljs-name\">dependency</span>></span></pre><h3>Gradle</h3>\n<pre>compile <span class=\"hljs-string\">'io.github.cdimascio:java-dotenv:1.1.0'</span></pre><h2>Usage</h2>\n<h3>Create a <code>.env</code> file</h3>\n<pre># formatted as key=value\nMY_ENV_VAR1=My first env var configure dotenv\nMY_EVV_VAR2=My second env var</pre><h3>Configure</h3>\n<p>Configure <code>java-dotenv</code> once in your application. \nSee below for <a href=\"#kotlin-usage\">Kotlin usage</a></p>\n<pre>Dotenv dotenv = Dotenv.Instance\n .configure()\n .build();</pre><p>see <a href=\"#configuration-options\">configuration options</a></p>\n<h3>Get environment variables</h3>\n<p>Note, environment variables specified in <code>.env</code> take precedence over those configured in the actual environment.</p>\n<pre>dotenv.get(<span class=\"hljs-string\">"MY_ENV_VAR1"</span>);</pre><h2>Configuration options</h2>\n<h3><em>optional</em> <code>directory(path: String)</code></h3>\n<p><code>path</code> specifies the directory containing <code>.env</code>. Dotenv first searches for <code>.env</code> using the given path on the filesystem. If not found, it searches the given path on the classpath. If <code>directory</code> is not specified it defaults to searching the current working directory on the filesystem. If not found, it searches the current directory on the classpath.</p>\n<h3><em>optional</em> <code>ignoreIfMalformed()</code></h3>\n<p>Do not throw when <code>.env</code> entries are malformed. Malformed entries are skipped.</p>\n<h3><em>optional</em> <code>ignoreIfMissing()</code></h3>\n<p>Do not throw when <code>.env</code> does not exist. Dotenv will continue to retrieve environment variables that are set in the environment e.g. <code>dotenv["HOME"]</code></p>\n<h2>Configuration examples</h2>\n<pre>Dotenv dotenv = Dotenv.Instance\n .configure()\n .directory(<span class=\"hljs-string\">"./some/path"</span>)\n .ignoreIfMalformed()\n .ignoreIfMissing()\n .build();</pre><h2>Kotlin usage</h2>\n<h3>Configure</h3>\n<p>Configure <code>java-dotenv</code> once in your application. (see below for <a href=\"#configure-(using-java-8\">Java</a>) usage)</p>\n<pre><span class=\"hljs-keyword\">val</span> dotenv = Dotenv.configure().build()</pre><p>see <a href=\"#configuration-options\">configuration options</a></p>\n<h3>Get environment variable</h3>\n<p>Note, environment variables specified in <code>.env</code> take precedence over those configured in the actual environment.</p>\n<pre>dotenv[<span class=\"hljs-string\">"MY_ENV_VAR1"</span>]</pre><p>with configuration options</p>\n<pre><span class=\"hljs-keyword\">val</span> dotenv = Dotenv\n .configure()\n .directory(<span class=\"hljs-string\">"./some/path"</span>) <span class=\"hljs-comment\">// set the directory containing .env</span>\n .ignoreIfMalformed() <span class=\"hljs-comment\">// do not throw an error if .env is malformed</span>\n .ignoreIfMissing() <span class=\"hljs-comment\">// do not throw an error if .env is missing</span>\n .build()</pre><h2>Examples</h2>\n<ul>\n<li>with <a href=\"https://github.com/cdimascio/kotlin-swagger-spring-functional-template\">Spring Framework</a> </li>\n</ul>\n<h2>License</h2>\n<p><a href=\"https://www.apache.org/licenses/LICENSE-2.0\">Apache 2.0</a></p>\n" | ||
}, | ||
{ | ||
"component": "footer", | ||
"links": [ | ||
{ | ||
"href": "https://github.com/cdimascio/java-dotenv", | ||
"text": "GitHub" | ||
}, | ||
{ | ||
"href": "https://github.com/cdimascio", | ||
"text": "cdimascio" | ||
} | ||
] | ||
} | ||
] | ||
} |