You are looking at historical revision 45264 of this page. It may differ significantly from its current revision.
dotenv
Description
A lightweight utility for CHICKEN Scheme that loads environment variables from a .env file into the current process's environment. It supports comments, trims whitespace, and handles values containing equal signs.
API
[procedure] (load-dotenv [filepath])
Reads the file specified by filepath (which defaults to ".env") and sets environment variables using the standard setenv procedure.
- Valid lines are formatted as KEY=VALUE.
- Lines starting with # are ignored as comments.
- Empty lines are ignored.
- Leading and trailing whitespace is automatically trimmed from both keys and values.
Examples
Assuming you have a file named .env:
DB_PORT=5432 API_KEY=secret_key_123 # This is a comment
You can load it in your Scheme code like this:
(import dotenv) ;; Load the default .env file (load-dotenv) ;; Access the variables (print (get-environment-variable "DB_PORT")) ; => "5432"
Requirements
About this egg
Author
Repository
https://github.com/masoodrb/dotenv
License
MIT