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

Add runtime-env for graalvm native-image support #95

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

cap10morgan
Copy link

@cap10morgan cap10morgan commented Aug 17, 2021

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).

@atomist
Copy link

atomist bot commented Aug 17, 2021

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.

@cap10morgan
Copy link
Author

This is an alternative solution to #92

It is a delay so that you it loads the config the first time you call
(runtime-env) but then caches it after that (like core/env does for
compile time config).
@SerhiiKozachenko
Copy link
Contributor

SerhiiKozachenko commented Feb 4, 2022

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.

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

Successfully merging this pull request may close these issues.

2 participants