[ClojureScript] Re: clojurescript configuration variables

2015-04-13 Thread Petunio Waterpillow
thank you, sir
it works

El miércoles, 8 de abril de 2015, 16:17:34 (UTC+2), Sebastian Bensusan  
escribió:
 Hi,
 
 I use https://github.com/weavejester/environ for configuration. To call it 
 from ClojureScript I usually wrap it in a macro like this:
 
 app/env.clj
 
 (ns app.env
   (:require [environ.core :refer [env]]))
 
 (defmacro cljs-env [kw]
   (env kw))
 
 put it in on project.clj
 
 :env {:rss-uri i-dont-know-how-rss-uri-look-like}
 
 and then call it from ClojureScript like this:
 
 app/view.cljs
 
 (ns app.view
   (:require-macros [app.env :as env :refer [cljs-env])
 
 (cljs-env :rss-uri)
 
 Note that the keyword :rss-uri needs to be available at compile time, since 
 that's when the code `(env kw)` will run.
 
 Hope this helps

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
ClojureScript group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.


[ClojureScript] Re: clojurescript configuration variables

2015-04-08 Thread Sebastian Bensusan
Hi,

I use https://github.com/weavejester/environ for configuration. To call it from 
ClojureScript I usually wrap it in a macro like this:

app/env.clj

(ns app.env
  (:require [environ.core :refer [env]]))

(defmacro cljs-env [kw]
  (env kw))

put it in on project.clj

:env {:rss-uri i-dont-know-how-rss-uri-look-like}

and then call it from ClojureScript like this:

app/view.cljs

(ns app.view
  (:require-macros [app.env :as env :refer [cljs-env])

(cljs-env :rss-uri)

Note that the keyword :rss-uri needs to be available at compile time, since 
that's when the code `(env kw)` will run.

Hope this helps

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
ClojureScript group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.