A Clojure library for managing environment variable configuration
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
Stephen Starkey 938ca4062a Next version 5 months ago
bin Fixed log printing 2 years ago
docs Modernized builds 2 years ago
spec/defenv More clarity on when you need an explicit env name 5 months ago
src/defenv Merge remote-tracking branch 'origin/master' 5 months ago
.env Sort the vars in the usage string. 4 years ago
.gitignore Modernized builds 2 years ago
LICENSE First version 4 years ago
README.md Merge remote-tracking branch 'origin/master' 5 months ago
defenv.css Generated environment variable documentation 3 years ago
project.clj Next version 5 months ago

README.md

defenv

A Clojure library designed to make working with environment variables easier.

Prerequisites

You'll need Java 8 and Leiningen.

Upgrading

Going from 1.0.* to 2.0.*

For security purposes, we have made masking of value display the default behavior. If you want to see the value of a variable, simply add :masked? false to everything that you don't want to mask.

Usage

Say you want to define a binding in a namespace that is filled in by the value specified in an environment variable. Here's the very simplest way to do it:

(require '[defenv.core :refer [defenv]])

(defenv path)

Then, if you run @path you will see the value of the PATH environment variable.

The project documentation contains much more example usage.

Also, you could try running DEFENV_TESTING=bob lein usage

Questions I imagined you might ask

Why does `defenv` make delayed bindings?

Well, the project contains a bit of other magic. If you don't make a binding to a variable optional, an exception will be thrown when it is dereferenced if it isn't set. We don't want these exceptions to be thrown during compile time. Therefore, they must be delayed.

Why can't I load property files and declare multiple
environments in my `project.clj` and stuff?

This library was designed for https://12factor.net/ apps

License

Copyright © 2021 Stephen Starkey

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.