core: Replace legacy INI config system with Pydantic-based TOML configuration.

This is a huge configuration refactoring.

The configuration system now uses Pydantic settings, with better validation, better
support for environment variables and other goodies.

The main config files now use TOML instead of INI, this allow for better handling of
complex types, notably dict.

Plugins, components and frontends can declare their config settings in a class which will
be imported dynamically.
This commit is contained in:
Goffi 2025-11-30 12:27:35 +01:00
commit 6a7b7bc36a

View file

@ -22,6 +22,7 @@ from twisted.internet import defer
from twisted.words.protocols.jabber import jid
from twisted.words.protocols.jabber import error
from twisted.words.protocols.jabber import sasl
from libervia.backend import G
from libervia.backend.core.i18n import _, D_
from libervia.backend.core.constants import Const as C
from libervia.backend.core import exceptions
@ -229,13 +230,8 @@ class InvitationsPlugin(object):
jid_ = kwargs.pop("jid_", None)
if not jid_:
domain = self.host.memory.config_get(None, "xmpp_domain")
if not domain:
# TODO: fallback to profile's domain
raise ValueError(_("You need to specify xmpp_domain in sat.conf"))
jid_ = "invitation-{uuid}@{domain}".format(
uuid=shortuuid.uuid(), domain=domain
)
domain = G.config.common.xmpp_domain
jid_ = f"invitation-{shortuuid.uuid()}@{domain}"
jid_ = jid.JID(jid_)
extra[KEY_JID] = jid_.full()