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

RootDir unused / Writing to zefs config #384

Open
patrickbkr opened this issue Jan 6, 2021 · 3 comments
Open

RootDir unused / Writing to zefs config #384

patrickbkr opened this issue Jan 6, 2021 · 3 comments

Comments

@patrickbkr
Copy link
Contributor

Context

The documentation explains a mechanism of how the config file is chosen. That mechanism seems not to be implemented. (A search for RootDir in the zef sources yields no relevant results).

I stumbled upon this while looking at a fez bug where fez tries to write to the zef config and fails because of missing permissions. In general I would consider this a valid use case. So I would favour a solution that will always allow changing the configuration. The first thing that comes to mind is a configuration hierarchy, where a config key in $*HOME/.zef/config.json would overwrite one in zefs default config which is part of it's installation. Then one could always create (should it not already exist) a config file in $*HOME/.zef/config.json and add the keys one wishes to override. The other keys would still be read from the default config.

Expected Behavior

Documentation and implementation match.

Actual Behavior

Documentation and implementation don't match up.

@ugexe
Copy link
Owner

ugexe commented Jan 7, 2021

Looks like RootDir support was removed in c5635d7#diff-0b87bf9585ac7013f75b9ed789159ff7023c204e52596ff6670d06bbda3d9787

and now its just using

zef/lib/Zef/Config.pm6

Lines 21 to 24 in 3c75618

my @path-candidates = (
(%*ENV<XDG_CONFIG_HOME> // "$*HOME/.config").IO.child('/zef/config.json'),
%?RESOURCES<config.json>.IO,
);

The original RootDir behavior could be revived, but it might be worth considering adding a subdir that is the current zef version (via $?DISTRIBUTION.meta<version>). Reason being so 1) breaking config changes don't break possibly installed older versions of zef, and 2) so upgrading zef doesn't automatically use the new config (although maybe also having a central location to allow that would be good too).

@patrickbkr
Copy link
Contributor Author

I'm not objected to a versioning of configuration files. I do think we should make sure that custom configuration options are not silently disabled on a zef upgrade though.

If I understand the RootDir approach correctly, it would not allow setting a single configuration value individually (by creating a configuration file in $*HOME/.zef/v123/config.json) without disabling the options specified in the default configuration and as a result probably breaking zef. Thus I am interested in your opinion on an override / fallback / layering mechanism for configuration files where values in a user configuration file in $*HOME/.zef/... would override values in the repo installed config file, but not disable it entirely.

@ugexe
Copy link
Owner

ugexe commented Jan 7, 2021

Ah right. At the very least there needs to be a way to append and replace. I liked the NuGet way other than being XML.

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