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

Feature: stop mixing the default config with user config in a single file #941

Open
1 task done
felipecrs opened this issue Jul 5, 2021 · 2 comments · May be fixed by #1069
Open
1 task done

Feature: stop mixing the default config with user config in a single file #941

felipecrs opened this issue Jul 5, 2021 · 2 comments · May be fixed by #1069

Comments

@felipecrs
Copy link
Contributor

felipecrs commented Jul 5, 2021

Feature request

All started with #928, which happened after I decided to include sdkman's config in my dotfiles repository: https://github.com/felipecrs/dotfiles/blob/c83fc79656129c35aa39501bab1c58f4a5bd683a/dot_sdkman/etc/config

So it turns out that sdkman expects some user configuration variables to be set, and treat them as the default settings. But it may not be a good idea to change the user's config file unattendedly during a self-update or on installation.

More insights comes from #927 (comment):

I'm 100% against assuming everyone will have this set in their config files. For example, I manage my dotfiles using another
program, so I'm the one who makes changes to it. If later in the future sdkman introduces new config variables, I would miss it as my dotfiles manager would override it with my own wrote config again.

I think there are 2 different things that should not be mixed:

  1. Default settings
  2. User preferences (the ~/.sdkman/etc/config file)

And I don't think sdkman should make changes unattended(ly) to the user preferences, but only to the default settings. Just like Git (~/.gitconfig) or any other tool.

So my proposal is:

Have the ~/.sdkman/etc/config as the default configuration source. This file can be included in this repository, and it does not need to be primed during an installation or dynamically updated during a self-update. An update of SDKMAN will contain the file, just like the other files.

Inside of this file, all the possible configuration variables will be set with their default values (some of them can be removed from sdkman-init.sh thus, such as the curl related ones).

Then, an user can optionally set its own configuration options in another file. And by following XDG's recommendation, this file should be at ~/.config/sdkman/config/~/.config/sdkman/rc. Or ~/.sdkmanconfig/~/.sdkmanrc.

The sdkman-main should read the configuration this way:

# load default settings
source $SDKMAN_DIR/etc/config

# load user settings
source $XDG_CONFIG_HOME/sdkman/config

The latter instruction will override any variables set with the default settings.

@untainsYD
Copy link

I really do support this ISSUE!!!

@sdavids
Copy link

sdavids commented Nov 3, 2023

#1069 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants