On Sunday, August 27, 2017 at 11:01:17 AM UTC-7, Royall Spence wrote:
> I'm starting work on a Racket library for loading .env files to override 
> environment variables. This is a common way of doing things for people who 
> want to run multiple web applications on a single server without their 
> environment variables competing for namespace. The classic example is this 
> Ruby library: https://github.com/bkeepers/dotenv
> 
> Just checking to make sure I haven't overlooked an already existing library 
> that provides this behavior. Should I keep going?

There is the Envy library for parsing environment variables, but there doesn't 
seem to be anything for loading .env files. Personally, I think this would be a 
great place to make a #lang that worked something like this:

#lang dotenv
my-library-num-workers = 5
my-library-tmpdir = "/tmp/my_library"

... and then if you `require` it, it sets the current environment. Or maybe it 
gives you a function to execute a thunk with the new environment. The advantage 
to using a #lang here instead of a file is your dotenv file is you no longer 
need to do any parsing or file IO at runtime and your env file is just a normal 
code module imported like any other. Plus you could write a syntax highlighter 
to make it easy to edit the env files in DrRacket.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to