environ icon indicating copy to clipboard operation
environ copied to clipboard

Add runtime-env for graalvm native-image support

Open cap10morgan opened this issue 3 years ago • 3 comments

I added core/runtime-env to better support graalvm native-image (where core/env reflects the compile time environment).

Since it's a delay you just deref it:

(require '[environ.core :as environ])
@environ/runtime-env

...and it returns the same data structure as core/env but reflects the runtime config environment.

It is a delay so that you it loads the config the first time you deref runtime-env but then caches it after that (like env does for compile time config).

cap10morgan avatar Aug 17 '21 17:08 cap10morgan

Commit messages of this repository should follow the seven rules of a great Git commit message, as mentioned in the project's contributing guidelines. It looks like there's a few issues with the commit messages in this pull request:

  • The commit message should not contain markdown.
  • The commit message body has a line over 72 characters.

atomist[bot] avatar Aug 17 '21 17:08 atomist[bot]

This is an alternative solution to #92

cap10morgan avatar Aug 17 '21 17:08 cap10morgan

As an option, maybe use: *compile-files* flag, https://groups.google.com/g/clojure/c/hhih2Ty7-Lc/m/yXa43-X441gJ

For example:

(defonce ^{:doc "A map of environment variables at runtime."}
  env (when-not *compile-files* (read-env)))

Nevermind, that doesn't help with native-image.

SerhiiKozachenko avatar Feb 04 '22 15:02 SerhiiKozachenko