Skip to content

Fix #6606 Distinguish global and project-level configuration files #6607

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

Merged
merged 1 commit into from
Jun 13, 2024

Conversation

mpilgrem
Copy link
Member

@mpilgrem mpilgrem commented Jun 9, 2024

Also refactors where:

  • 'project' is used to refer to a file or directory that may not be within a project directory but within the Stack root; or

  • stackYaml is used to refer to a configuration file that may be a global one as well as a project-level one.

  • Any changes that could be relevant to users have been recorded in ChangeLog.md.

  • The documentation has been updated, if necessary

Please also shortly describe how you tested your change. Bonus points for added tests! Relying on CI.

@philderbeast
Copy link
Contributor

As this includes a renaming, would it make sense to drop Yaml altogether in those names and go with more meaningful names, something like Project* versus Global*, where * is something like Config or Settings?

@mpilgrem
Copy link
Member Author

mpilgrem commented Jun 9, 2024

@philderbeast, I am open to suggestions on naming of the field of the BuildConfig constructor - I think everything else flows from that choice. At the moment, Stack has:

  • at most one project-level YAML configuration file, named stack.yaml by default but can be any *.yaml file; and
  • a user-specific global YAML configuration file, named config.yaml in the Stack Root; and
  • (according to the documentation; I need to check the code to see if that is correct - EDIT: see further post below) perhaps, system-wide global YAML configuration file, named config.yaml in /etc/stack (but that is a Unix-like file path?).

I picked yamlFile for the path to the YAML configuration file because what *.yaml and config.yaml had in common was the 'YAML' part. The problem with configYaml or, even, configFile is that people might assume it refers to config.yaml only, given the 'config' part. The problem with settingsFile or settingsYaml is that the term 'settings' is not used anywhere else to refer to these files.

@mpilgrem
Copy link
Member Author

mpilgrem commented Jun 9, 2024

Looking at Stack.Config.loadConfig and:

extraConfigs0 <- getExtraConfigs userConfigPath >>=
    mapM (\file -> loadConfigYaml (parseConfigMonoid (parent file)) file)

the 'extra' global configuration files are under- or un-documented on online. I'll raise that as a separate issue.

@mpilgrem
Copy link
Member Author

mpilgrem commented Jun 9, 2024

@philderbeast, on reflection, I decided to prefer configFile to yamlFile and, where applicable, use Right projectConfigFile ->.

@philderbeast
Copy link
Contributor

Your choice of ConfigFile aligns with Cabal naming a similar thing ProjectConfigPath1.

Footnotes

  1. YAML can't do imports but Cabal's projects can so that is why it is a path and not a file over there.

Also refactors where:

* 'project' is used to refer to a file or directory that may not be within a project directory but within the Stack root;
* `stackYaml` is used to refer to a configuration file that may be a user-specific global one as well as a project-level one; or
* `userConfigPath` or `stackGlobalConfig` refers to the user-specific global configuration file (`userGlobalConfigFile`).

Also refactors descriptions in `stack path` to use the terminology of user-specific global configuration file or project-level configuration file (`stack.yaml`, by default).
@mpilgrem mpilgrem merged commit e0f17ca into master Jun 13, 2024
14 checks passed
@mpilgrem mpilgrem deleted the fix6606 branch June 13, 2024 00:32
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

Successfully merging this pull request may close these issues.

2 participants