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

Overlay variable handling is unpractical #838

Open
galdor opened this issue Nov 21, 2020 · 4 comments
Open

Overlay variable handling is unpractical #838

galdor opened this issue Nov 21, 2020 · 4 comments

Comments

@galdor
Copy link
Contributor

galdor commented Nov 21, 2020

In the current state, overlay variables provided by the user in a file are being overriden by variables set by rebar3 and relx. This is the opposite behaviour from what is currently used in any software, where user settings usually override default settings (which makes sense since a user cannot modify default settings).

The problem is compounded by the fact that both rebar3 and relx use lots of variables at top-level without any hierarchy. The worse example is that rebar3 adds a variable for each application, which is associated with its build dir. Therefore adding new dependencies can potentially override existing user variables without any warning.

While I feel that variable overriding should be reversed (relx variables <- rebar3 variables <- overlay_vars variables <- files referenced in the overlay_vars files), I imagine this would cause lots of issues for users.

Another possibility would be to introduce a clear hierarchy, with relx and rebar3 as top levels, which would avoid any potential conflict with user variables. Something similar to the system configuration file of Erlang. Bonus point for using maps instead of lists of pairs. This would also be an uncompatible change.

What do you think about it ?

@tsloughter
Copy link
Member

Do you mean variables set in the rebar.config relx section? Or passing a vars file from the cli?

@lrascao
Copy link
Collaborator

lrascao commented Nov 21, 2020

overlay variables provided by the user in a file are being overriden by variables set by rebar3 and relx

could you provide an example please?

@galdor
Copy link
Contributor Author

galdor commented Nov 21, 2020

I mean variables set in the overlay_vars file..

@ioolkos
Copy link

ioolkos commented Jul 14, 2021

This is probably not the same issue, but I just noticed that you can't append the same key to a vars.config overlay_vars file.

{key, "a"}.
{key, "b"}.

{{key}} will evalue to "a", not "b". The latter would be useful to cat adaptations for different build profiles.

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

4 participants