Closed doublevcodes closed 2 years ago
I would like to work on this, it would be based on the work done by arl on discord-modmail/modmail#75, where one could write configuration classes using marshmallow and attrs. This would support auto-generation of docs in the config file.
Example:
@attr.s(auto_attribs=True, slots=True)
class TwitterAuthCfg:
"""Twitter account authentication configuration."""
api_key: str = attr.ib(
default="",
on_setattr=attr.setters.frozen,
repr=False,
metadata={
"required": True,
"allow_none": False,
METADATA_TABLE: ConfigMetadata(
description="Think of this as the user name that represents your account when using the app.",
),
},
)
api_secret: str = attr.ib(
default="",
on_setattr=attr.setters.frozen,
repr=False,
metadata={
"required": True,
"allow_none": False,
METADATA_TABLE: ConfigMetadata(
description="Think of this as the password that represents your account when using the app.",
),
},
)
Would auto-generate:
[auth]
# Think of this as the user name that represents your account when using the app.
api_key = ""
# Think of this as the password that represents your account when using the app.
api_secret = ""
So how would this work, a default configuration is generated with lots of empty keys? I'd prefer that the configuration file only contain keys that need to be used.
So how would this work, a default configuration is generated with lots of empty keys? I'd prefer that the configuration file only contain keys that need to be used.
Yes, it would only include the config keys which are required, and possibly I could add a separate flag if the user wants to generate with "all" of the keys.
So how would this work, a default configuration is generated with lots of empty keys? I'd prefer that the configuration file only contain keys that need to be used.
Yes, it would only include the config keys which are required, and possibly I could add a separate flag if the user wants to generate with "all" of the keys.
That sounds good.
So:
Should be closed by #6
The user needs to be able to set options within a
sirius.config.toml
file. This will be implemented usingtomli