-
-
Notifications
You must be signed in to change notification settings - Fork 60
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
[PROPOSAL] Better, simpler and unified config #248
Conversation
Replaces the old static configuration system with a dynamic `Config` class supporting nested structures, defaults, YAML serialization and direct access as attributes. Introduces enhanced CLI options for better usability and removes deprecated configuration files and structures.
Updated the configuration documentation to clarify that several settings can now be overridden through command-line arguments. This improves flexibility and provides clearer guidance for users to customize behavior.
Im testing your repo on a separate account and it seems to be working relatively well. I will try and reach out to Cal and see how he would like to proceed as he was working on it and I do not want to change any files he may have pending. |
Hello, got any news? |
Was working well for me - I was hoping @cal4 would be able to check it if possible to see if I missed anything. If he doesn't get to look at it by the time I get back this evening I will merge things accordingly. |
i like the —email and —password flag(?arg)'s , this can be very useful specially for newbies, also it is interesting what will happen if it is used 2 times in the same folder with different Accounts. Also Adding a cooldown into config.yaml is useful. maybe adding one thing to the --create-config Flag(?arg) could be that he checks if already one exists before creating one file and adding some messages into that, so if someone does this mistakenly he will not override his file, and instead getting a warning Message about the already existing File, but in all it sounds very useful. |
It already does!
|
Warning
The purpose of this PR is to discuss a potentially better way to handle configuration. While it is 100% functional as it is, it involves huge changes to the script, especially the user interactions, and may introduce unwanted behavior, and should be discussed before merging anything.
This takes a different approach to configuration, with two goals in mind: simplicity, both for users and maintainers, and dynamism.
Benefits
For developers
CONFIG
variable.CONFIG[]
:CONFIG["apprise.notify.login-code"]
instead ofCONFIG["apprise"]["notify"]["login-code"]
.CONFIG.get()
:CONFIG.get("apprise.notify.login-code")
instead ofCONFIG.get("apprise").get("notify").get("login-code")
(Note that the old method would throw an error ifCONFIG.get("apprise")
returnsNone
, because the.get
method is not a valid method forNoneType
, but the new one allows you to getNone
even if theapprise
key is not in the config.CONFIG.activities.ignore
(equivalent toCONFIG["activities"]["ignore"]
).--debug
,--email
,--password
and--config
flags, and the 0-configuration-run.For users
--email
and--password
flags, which allow 0-configuration-run).activities.search
(useful to quickly add your own language searches),cooldown.min
/cooldown.max
(useful to speed up the program or try to avoid banning it at most), previously command-line specific options, and more. For the full list of allowed configuration variables, see theREADME.md
.Config
class), no need to rewrite/copy the whole configuration, just add what you need.Changes
Added
Config
type, which extends the functionality of dictionaries to allow simpler ways to manage configuration.--config
flag, which can be used to specify the configuration path.--create-config
flag, which can be used to create an empty configuration file (instead of copying and renaming a template file). Note that the created file will already be populated with any configuration options passed from the command line.--email
and--password
flags, which allow the script to be run for a single user, even without a configuration file.--debug
flag, which allows to set the logging level toDEBUG
.Changed
config.yaml
.CONFIG
) and accessed through it.account.username
values have been renamed toaccount.email
, both internally and in the configuration.apprise.notify.uncaught-exception.enabled
, which has been moved toapprise.notify.uncaught-exception
(because theenabled
key is redundant), andapprise.notify.incomplete-activity.ignore
, which has been moved toactivities.ignore
(because it does not only affect apprise). For the full list of allowed configuration variables, see theREADME.md
.README.md
,.github/ISSUE_TEMPLATE/bug_report.yml
,test/test_main.py
andtest/test_utils.py
to reflect these changes.Removed
Account
data model.--chromeversion
flag, deprecated as of 982a592.--verbosenotifs
flag, deprecated as of 77fc8f0.