-
Notifications
You must be signed in to change notification settings - Fork 103
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
miral::ConfigFile #3544
miral::ConfigFile #3544
Conversation
Split this out of #3531 as it is generally useful |
Might also succeed #3478 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's one thing that we could consider here: monitoring all the applicable folders for new files. I mean, if a file shows isn't in $XDG_CONFIG_HOME
on startup, but is added later, we won't consider it.
Also the XDG_CONFIG_DIRS
handling is static - we only load from it once.
Could we have tests, please?
Should we consider It's surprising that this: |
I vote not. The XDG Base Directory spec. doesn't mention
For arbitrary files I would agree. But config files typically don't load from the current directory.
Yes we do.
We could, but is there any benefit to monitoring for system-wide configuration? Session wide configuration changes should be in
We could. Just seemed a bit much for glue code that hits the filesystem |
Adding some paint to the bikeshed :) But |
Before we paint the wrong bikeshed, this is about configuration files used by a compositor, not files specified on the command-line (or in the configuration). |
True enough! At any rate, I think $PWD is a bit confusing to add to the places to search. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could, but is there any benefit to monitoring for system-wide configuration? Session wide configuration changes should be in
$XDG_CONFIG_HOME
.
I think we should be consistent between system-wide and user-local configuration behaviour.
Also, for the ubuntu-frame
configuration do we try to stick it in the user-local or system-wide location?
If running as daemon: Otherwise, the defaults. |
As [mentioned](#3544 (comment)) by @RAOF, we don't want the FD leaking to child processes
932dbed
to
f888bf8
Compare
OK, the following questions raised above have not been resolved:
Also, not mentioned (yet):
The proposed code answers as follows:
Also, mentioned above, but I think resolved:
I think this is useful and understandable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1. How should we treat relative paths? Relative to `$PWD`, and monitor for changes 2. How do we treat absolute paths? As absolute paths, and monitor for changes
I think I'm OK with this. But maybe we want to be more verbose about it? Logging which file we've loaded and/or are monitoring?
3. Should we monitor the `XDG_CONFIG_DIRS` paths? No
Sounds like a potential extension later.
It does relate to:
There's one thing that we could consider here: monitoring all the applicable folders for new files. I mean, if a file shows isn't in
$XDG_CONFIG_HOME
on startup, but is added later, we won't consider it.Yes we do.
OK I miswrote. XDG_CONFIG_HOME
(or rather, config_directory()
) is the only folder we're monitoring. If things happen within "earlier" XDG_CONFIG_DIRS
, we won't notice. But that may be extreme.
4. Should we detect file deletion and load a config from a later base location? No
My only problem with that is that we're behaving differently live than on startup.
5. Should we look in `$PWD`? No
👍
Thanks for the tests! Happy they helped :)
There are no "earlier" |
There are, if there's more than one in |
We're in agreement on what happens, just not clear on the referent to "earlier" |
Anyway! I don't think it's a blocker, but we probably should spell it out that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would just like to see more logging here. But you have my ACK.
"Monitoring $path/$file for configuration changes"
"Loaded configuration from $path/$file"
"Failed to open $path/$file"
Oh, no. While pondering
I was going to answer “Yes, we should monitor I do think that we should support changing the system-wide config at runtime, and the standard way of doing that is something like “reload config on |
To recap what we discussed:
|
A (different, in addition) summary of discussion:
Maybe I should rename the class |
This reverts commit efbc8a6.
e4dc3db
to
618d5fc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whitespace nit, otherwise good with me.
A utility class to locate and (re)load configuration files when they change. The actual
Loader
processing of the file is one customization point, the reloading strategy another.