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

how to reset the env when hot code change #20

Open
HillCool opened this issue Nov 29, 2018 · 2 comments
Open

how to reset the env when hot code change #20

HillCool opened this issue Nov 29, 2018 · 2 comments

Comments

@HillCool
Copy link

thank you for notice, here is the situation. i have a release project named V1.0.1, and i want to use rebar3 upgrade, everything is ok ,but when i rebar3 attach ,the project can't read the env due to collapse,i try to use application:get_env ,it is undefined. Actually, i set the env in my supervisor (the top level in monitor tree),so can you tell me how to solve this problem ?
i find some doc about file appup, but not relup, should i add something setting in the relup? here is what i found about appup, watting you answer
https://medium.com/@kansi/hot-code-loading-with-erlang-and-rebar3-8252af16605b

@ferd
Copy link

ferd commented Nov 29, 2018

This is something that Erlang/OTP does automatically; it resets the environment values to whatever was in (in order): command line arguments > sys.config > .app's env

There is no workaround aside from storing dynamic configuration under a name like myapp_dymamic which won't get reset -- only the variables of existing loaded applications get reset.

@HillCool
Copy link
Author

@ferd ,thank you for your answer, i solve my problem by change the appup file, i modify appup file to load moudle ,and apply {M,F,A} ,it help me reset env, last is rebar3 relup ,get a relup file , and then ,it is work

@HillCool HillCool reopened this Nov 30, 2018
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

2 participants