-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
fix: have some sys configs with one -config flag #2071
Conversation
Hi, |
Current implementation reads all files. The difference is that it works with |
sys.config has a special meaning in release. Only this file can point to other includes. As far I can remember. |
'sys.config Release handling relies on this assumption. When installing a new release version, the new sys.config is read and used to update the application configurations' |
@@ -1833,7 +1833,7 @@ check_conf() -> | |||
{error, {Line, _Mod, Str}} -> | |||
throw({error, {FName, Line, Str}}) | |||
end | |||
end, [], Files)}; | |||
end, [], lists:foldr(fun erlang:'++'/2, [], Files))}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this is equivalent to lists:flatten/1
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather to lists:append
, since it will only go 1 level deep.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I tested flatten/1
before:
$ erl -foo a b c -foo x y z
Erlang/OTP 20 [erts-9.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:10] [kernel-poll:false]
Eshell V9.2 (abort with ^G)
1> {_, V} = init:get_argument(foo).
{ok,[["a","b","c"],["x","y","z"]]}
2> lists:flatten(V).
"abcxyz"
3> lists:foldr(fun erlang:'++'/2, [], V).
["a","b","c","x","y","z"]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, good point, thanks. In this case, lists:append/1
proposed by @ferd should do it. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
append/1
works well. Thank you @ferd .
I think this change is ok. Even if release handling assumes one config file only, it is already possible to use several config files when release handling is not an issue. So this change does not open any door that isn't already open. The PR does however need some tests, and the documentation of the |
Hello @pouriya-jahanbakhsh do you plan to add tests+docs? or should I close this PR? |
Hi. I'm sorry for the delay in response. I'm working on it. |
Bad news is that I deleted my fork of OTP in github and my PC :-S. So I've opened a new pr #2359. |
Because here we have
[["sys.config", "sys2.config"]]
and here it does not be matched. So we have to run:~ $ erl -config sys.config -config sys2.config
I was adding
dynamic configuration
based changes in sys config files and I found this. Sorry if branch name does not relate to this.