Skip to content

Commit a112d34

Browse files
committed
Add missing default values to BackendConfig to fix CliBackendConfig
1 parent 64dcc5b commit a112d34

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

newsfragments/11702.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fixed broken server CLI commands (export, inspect, sequester create/list/revoke)

server/parsec/cli/utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -298,9 +298,9 @@ def server_addr(self) -> ParsecAddr: # type: ignore[reportIncompatibleVariableO
298298
db_config=db_config,
299299
blockstore_config=blockstore_config,
300300
administration_token=None, # type: ignore
301-
fake_account_password_algorithm_seed=None,
302-
email_config=None,
303-
server_addr=None,
301+
fake_account_password_algorithm_seed=None, # type: ignore
302+
email_config=None, # type: ignore
303+
server_addr=None, # type: ignore
304304
)
305305
# Cannot directly initialize a `CliBackendConfig` since its
306306
# `administration_token`/`email_config`/`server_addr`/etc. fields have no setter.

server/parsec/config.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
SecretKey,
1919
)
2020
from parsec.email_rate_limit import EmailRateLimit
21+
from parsec.templates import get_environment
2122

2223
if TYPE_CHECKING:
2324
from parsec.components.memory.organization import MemoryOrganization, OrganizationID
@@ -252,7 +253,7 @@ class OpenBaoConfig:
252253
@dataclass(slots=True, kw_only=True)
253254
class BackendConfig:
254255
debug: bool
255-
jinja_env: Environment
256+
jinja_env: Environment = field(default_factory=lambda: get_environment(None))
256257
db_config: BaseDatabaseConfig
257258
blockstore_config: BaseBlockStoreConfig
258259
email_config: SmtpEmailConfig | MockedEmailConfig
@@ -266,11 +267,11 @@ class BackendConfig:
266267
# Bearer token used to authenticate the administration API
267268
administration_token: str
268269

269-
# Minimal wait time (in seconds) between two email having the same recipient or initiator IP address
270-
email_rate_limit_cooldown_delay: int
271-
# Maximum number of mail send per hour for any given recipient or initiator IP address
272-
# Note setting it to `0` disable the check.
273-
email_rate_limit_max_per_hour: int
270+
# Minimal wait time (in seconds) between two emails having the same recipient or initiator IP address
271+
email_rate_limit_cooldown_delay: int = 0
272+
# Maximum number of mails sent per hour for any given recipient or initiator IP address
273+
# Note setting it to `0` disables the check.
274+
email_rate_limit_max_per_hour: int = 0
274275
# Small hack here: since the rate limit system is purely in-memory and configured
275276
# only by fields from this class, we instantiate here to simplify passing it
276277
# to the different components needing it.

0 commit comments

Comments
 (0)