Use new forbidden default value system in mautrix-python. Fixes #388
This commit is contained in:
+1
-1
@@ -33,7 +33,7 @@ appservice:
|
||||
# the HS database.
|
||||
public:
|
||||
# Whether or not the public-facing endpoints should be enabled.
|
||||
enabled: true
|
||||
enabled: false
|
||||
# The prefix to use in the public-facing endpoints.
|
||||
prefix: /public
|
||||
# The base URL where the public-facing endpoints are available. The prefix is not added
|
||||
|
||||
@@ -19,7 +19,8 @@ import os
|
||||
|
||||
from mautrix.types import UserID
|
||||
from mautrix.client import Client
|
||||
from mautrix.bridge.config import BaseBridgeConfig, ConfigUpdateHelper
|
||||
from mautrix.bridge.config import (BaseBridgeConfig, ConfigUpdateHelper, ForbiddenKey,
|
||||
ForbiddenDefault)
|
||||
|
||||
Permissions = NamedTuple("Permissions", relaybot=bool, user=bool, puppeting=bool,
|
||||
matrix_puppeting=bool, admin=bool, level=str)
|
||||
@@ -32,6 +33,17 @@ class Config(BaseBridgeConfig):
|
||||
except KeyError:
|
||||
return super().__getitem__(key)
|
||||
|
||||
@property
|
||||
def forbidden_defaults(self) -> List[ForbiddenDefault]:
|
||||
return [
|
||||
*super().forbidden_defaults,
|
||||
ForbiddenDefault("appservice.public.external", "https://example.com/public",
|
||||
condition="appservice.public.enabled"),
|
||||
ForbiddenDefault("bridge.permissions", ForbiddenKey("example.com")),
|
||||
ForbiddenDefault("telegram.api_id", 12345),
|
||||
ForbiddenDefault("telegram.api_hash", "tjyd5yge35lbodk1xwzw2jstp90k55qz"),
|
||||
]
|
||||
|
||||
def do_update(self, helper: ConfigUpdateHelper) -> None:
|
||||
copy, copy_dict, base = helper
|
||||
|
||||
|
||||
Reference in New Issue
Block a user