Support sys.config.src in common test #2571
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #2096
Hello!
It's really nice to call
rebar3 shell
and have.config.src
files automatically loaded, much like they are in Erlang releases. I was surprised to see thatrebar3 ct
doesn't do the same sort of substitution with environment variables. With these changes, it is now possible.A big portion of this PR is moving
consult_env_config/2
fromrebar_priv_shell.erl
torebar_file_utils.erl
.I have some remaining questions/statements:
rebar_file_utils:consult_config/2
read the extension of the file, and automatically callconsult_env_config
if the extension is.src
? The branching for.config
and.config.src
is currently duplicated, but I'm not exactly sure if it's the right move to DRY in this case.consult_config
to only prependRootDir
if a config fileconsult
ed from a .config file is a relative path.erl -man config
seems to recommend using absolute paths in sys.config files, so I wanted to be sure that we don't do any unfortunate path mangling when there an absolute path is found.env_file
option ineunit_opts
, add a .config.src file to test/rebar_eunit_SUITE_data/syscfg_app.zip, along with an appropriate env_file. I could probably submit that as another PR; just say the word :)rebar_prv_common_test
currently callsrebar_prv_shell:maybe_set_env_vars
, introducing a dependency edge between two provider modules that didn't exist before. I don't mind movingmaybe_set_env_vars
to a module likerebar_file_utils
if you'd like to avoid coupling the rebar_prv_shell and rebar_prv_common_test.