forked from kernelci/kernelci-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.py
More file actions
45 lines (34 loc) · 1.29 KB
/
config.py
File metadata and controls
45 lines (34 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# SPDX-License-Identifier: LGPL-2.1-or-later
#
# Copyright (C) 2023 Collabora Limited
# Author: Jeny Sadadia <jeny.sadadia@collabora.com>
"""Module settings"""
from pydantic import EmailStr
from pydantic_settings import BaseSettings
# pylint: disable=too-few-public-methods
class AuthSettings(BaseSettings):
"""Authentication settings"""
secret_key: str
algorithm: str = "HS256"
# Set to None so tokens don't expire
access_token_expire_seconds: float = 315360000
invite_token_expire_seconds: int = 60 * 60 * 24 * 7 # 7 days
public_base_url: str | None = None
# pylint: disable=too-few-public-methods
class PubSubSettings(BaseSettings):
"""Pub/Sub settings loaded from the environment"""
cloud_events_source: str = "https://api.kernelci.org/"
redis_host: str = "redis"
redis_db_number: int = 1
keep_alive_period: int = 45
# MongoDB durable pub/sub settings
event_ttl_days: int = 7 # Auto-delete events after N days
max_catchup_events: int = 1000 # Max events to deliver on reconnect
subscriber_state_ttl_days: int = 30 # Cleanup unused subscriber states
# pylint: disable=too-few-public-methods
class EmailSettings(BaseSettings):
"""Email settings"""
smtp_host: str
smtp_port: int
email_sender: EmailStr
email_password: str