mirror of
https://git.pleroma.social/pleroma/relay.git
synced 2024-11-21 22:17:59 +00:00
ensure int config values are above 0
This commit is contained in:
parent
1eb93ab71a
commit
38ea8b390e
|
@ -190,4 +190,14 @@ class Config:
|
||||||
if key in {'port', 'pg_port', 'workers'} and not isinstance(value, int):
|
if key in {'port', 'pg_port', 'workers'} and not isinstance(value, int):
|
||||||
value = int(value)
|
value = int(value)
|
||||||
|
|
||||||
|
if value < 1:
|
||||||
|
if key == 'port':
|
||||||
|
value = 8080
|
||||||
|
|
||||||
|
elif key == 'pg_port':
|
||||||
|
value = 5432
|
||||||
|
|
||||||
|
elif key == 'workers':
|
||||||
|
value = len(os.sched_getaffinity(0))
|
||||||
|
|
||||||
setattr(self, key, value)
|
setattr(self, key, value)
|
||||||
|
|
Loading…
Reference in a new issue