mirror of
https://git.pleroma.social/pleroma/relay.git
synced 2024-11-25 07:51:09 +00:00
reset config on load
This commit is contained in:
parent
78ce1763e0
commit
f397e10b04
|
@ -32,27 +32,15 @@ class RelayConfig(DotDict):
|
||||||
|
|
||||||
|
|
||||||
def __init__(self, path, is_docker):
|
def __init__(self, path, is_docker):
|
||||||
|
DotDict.__init__(self, {})
|
||||||
|
|
||||||
if is_docker:
|
if is_docker:
|
||||||
path = '/data/relay.yaml'
|
path = '/data/relay.yaml'
|
||||||
|
|
||||||
self._isdocker = is_docker
|
self._isdocker = is_docker
|
||||||
self._path = Path(path).expanduser()
|
self._path = Path(path).expanduser()
|
||||||
|
|
||||||
super().__init__({
|
self.reset()
|
||||||
'db': str(self._path.parent.joinpath(f'{self._path.stem}.jsonld')),
|
|
||||||
'listen': '0.0.0.0',
|
|
||||||
'port': 8080,
|
|
||||||
'note': 'Make a note about your instance here.',
|
|
||||||
'push_limit': 512,
|
|
||||||
'host': 'relay.example.com',
|
|
||||||
'blocked_software': [],
|
|
||||||
'blocked_instances': [],
|
|
||||||
'whitelist': [],
|
|
||||||
'whitelist_enabled': False,
|
|
||||||
'json': 1024,
|
|
||||||
'objects': 1024,
|
|
||||||
'digests': 1024
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
def __setitem__(self, key, value):
|
def __setitem__(self, key, value):
|
||||||
|
@ -96,6 +84,24 @@ class RelayConfig(DotDict):
|
||||||
return f'{self.actor}#main-key'
|
return f'{self.actor}#main-key'
|
||||||
|
|
||||||
|
|
||||||
|
def reset(self):
|
||||||
|
self.clear()
|
||||||
|
self.update({
|
||||||
|
'db': str(self._path.parent.joinpath(f'{self._path.stem}.jsonld')),
|
||||||
|
'listen': '0.0.0.0',
|
||||||
|
'port': 8080,
|
||||||
|
'note': 'Make a note about your instance here.',
|
||||||
|
'push_limit': 512,
|
||||||
|
'host': 'relay.example.com',
|
||||||
|
'blocked_software': [],
|
||||||
|
'blocked_instances': [],
|
||||||
|
'whitelist': [],
|
||||||
|
'whitelist_enabled': False,
|
||||||
|
'json': 1024,
|
||||||
|
'objects': 1024,
|
||||||
|
'digests': 1024
|
||||||
|
})
|
||||||
|
|
||||||
def ban_instance(self, instance):
|
def ban_instance(self, instance):
|
||||||
if instance.startswith('http'):
|
if instance.startswith('http'):
|
||||||
instance = urlparse(instance).hostname
|
instance = urlparse(instance).hostname
|
||||||
|
@ -181,6 +187,8 @@ class RelayConfig(DotDict):
|
||||||
|
|
||||||
|
|
||||||
def load(self):
|
def load(self):
|
||||||
|
self.reset()
|
||||||
|
|
||||||
options = {}
|
options = {}
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in a new issue