cprop icon indicating copy to clipboard operation
cprop copied to clipboard

How to update the java env settings?

Open WorldsEndless opened this issue 7 years ago • 2 comments

This isn't a cprop problem, but I think this might be the best place to get a simple answer. I want to use env vars in my app, hence cprop; however, once I add something to my bashrc and source it, I still don't seem to see it in any clojure app until I've restarted my entire system; I've tried restarting the REPL, restarting the shell, closing down all java apps, etc, and none of these pulls in the vars. Surely I don't need to restart every time to get java to see my new env vars! What do I need to do?

Thanks!

WorldsEndless avatar Feb 11 '17 18:02 WorldsEndless

your expectation is perfectly correct: env changes in the same terminal should be picked up:

say we have these two files, config and overrides:

[/tmp]$ cat config.edn
{:foo {:bar-baz "OVERRIDE ME"}}

[/tmp]$ cat overrides.sh
export FOO__BAR_BAZ=42

trying to load config without previously sourcing the overrides:

[/tmp]$ boot repl
boot.user=> (set-env! :dependencies '[[cprop "0.1.10"]])
boot.user=> (require '[cprop.core :as c])
boot.user=> (c/load-config :file "/tmp/config.edn")

read config from file: "/tmp/config.edn"
{:foo {:bar-baz "OVERRIDE ME"}}

boot.user=> Bye for now!

sourcing overrides and trying again:

[/tmp]$ source overrides.sh

[/tmp]$ boot repl
boot.user=> (set-env! :dependencies '[[cprop "0.1.10"]])
boot.user=> (require '[cprop.core :as c])
boot.user=> (c/load-config :file "/tmp/config.edn")

read config from file: "/tmp/config.edn"
{:foo {:bar-baz 42}}

One thing to check after you sourced your env file is whether the shell actually sees your variable(s):

[/tmp]$ env | grep FOO
FOO__BAR_BAZ=42

tolitius avatar Feb 11 '17 18:02 tolitius

Would there be any difference in my using lein run or just cider-jack-in instead of lein repl or boot repl?

WorldsEndless avatar Feb 11 '17 18:02 WorldsEndless