Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NodeJS compatibility #69

Open
grav opened this issue Mar 1, 2017 · 3 comments
Open

NodeJS compatibility #69

grav opened this issue Mar 1, 2017 · 3 comments

Comments

@grav
Copy link

grav commented Mar 1, 2017

Would it make sense to make environ a wrapper around process.env? I have some code that does at least part of it, and I'll try my luck with a pull request if it's at all a sensible feature:

(ns environ.core
  (:require [clojure.string :as str]))

(defn- s->k [s]
  (-> s
      str/lower-case
      (str/replace "_" "-")
      keyword))

(def env
  (->> js/process.env
       js/Object.keys
       js->clj
       (map (fn [k] [(s->k k) (aget js/process.env k)]))
       (into {})))
@arichiardi
Copy link

This is very interesting also for self-hosted Clojure environments like lumo.

@grav
Copy link
Author

grav commented Mar 2, 2017

On second thought, it does make sense to me in a shared node/jvm context, so I went ahead and did a pr: #70

@grav grav closed this as completed Mar 2, 2017
@weavejester
Copy link
Owner

You don't need to close an issue because a PR is opened. The issue still exists until the PR is merged, after all.

@weavejester weavejester reopened this Mar 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants