Skip to content

LispLima/cl-dotenv

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cl-dotenv - Load .env files from Common Lisp

Build Status Coverage Status

Tiny utility library for loading .env files & getting/setting environment variables.

Currently tested with: SBCL, Allegro, ECL, CLISP

Usage

NOTE: Corrupt .env files will generate an error when being loaded. Make sure your .env file is in the format:

  key1=value   
  key2=value   

Load & set the environment from an .env file

Calling load-env loads the environment from the specified .env file.

  (dotenv:load-env (merge-pathnames "./path/.env")) 
    => t

Get an environment variable

The value of a variable can be read by calling get-env with the name of the variable.

  (dotenv:get-env "SOME_VAR")
    => "value" or nil

If you wish, you can provide a default value that is returned if the variable you are trying to read is not set.

  (dotenv:get-env "SOME_NONEXISTING_VAR" "default-value")
    => "default-value"

Set an environment variable

Setting a variable overwrites any existing value

  (dotenv:set-env "SOME_VAR" "some_value")
    => t

Installation

The package is not yet available through Quicklisp. (Issue)

Manual installation steps:

  cd ~/quicklisp/local-projects/   
  git clone https://github.com/ollelauribostrom/cl-dotenv.git  
  (ql:quickload :cl-dotenv)

Contributing

All contributions are very much welcome. Please get familiar with the contributing guide.

Commands

  • make install: Install the packages cl-dotenv and cl-dotenv-test locally using Roswell
  • make test: Run the tests using Prove
  • make coverage: Run the tests and generate a coverage report
  • make sbcl: Start SBCL and load cl-dotenv

Author

Inspiration

License

Licensed under the MIT License.

About

Load .env files from Common Lisp

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Common Lisp 78.6%
  • Makefile 21.4%