-
Notifications
You must be signed in to change notification settings - Fork 18
/
models.py
86 lines (63 loc) · 1.6 KB
/
models.py
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
from datetime import datetime
from typing import List, Optional
from pydantic import BaseModel
class AdminConfig(BaseModel):
username: str
password: str
class DatabaseConfig(BaseModel):
user: str
password: str
host: str = 'postgres'
port: int = 5432
dbname: str = 'forcad'
class RabbitMQConfig(BaseModel):
user: str
password: str
host: str = 'rabbitmq'
port: int = 5672
vhost: str = 'forcad'
class RedisConfig(BaseModel):
password: str
host: str = 'redis'
port: int = 6379
db: int = 0
class StoragesConfig(BaseModel):
db: DatabaseConfig
rabbitmq: RabbitMQConfig
redis: RedisConfig
class GameConfig(BaseModel):
flag_lifetime: int
round_time: int
start_time: datetime
timezone: str = 'UTC'
default_score: float = 2500
game_hardness: float = 10
mode: str = 'classic'
get_period: Optional[int] = None
inflation: bool = True
volga_attacks_mode: bool = False
checkers_path: str = '/checkers/'
env_path: str = ''
class Task(BaseModel):
name: str
checker: str
gets: int = 1
puts: int = 1
places: int = 1
checker_timeout: int = 10
checker_type: str = 'hackerdom'
env_path: Optional[str] = None
default_score: Optional[float] = None
get_period: Optional[int] = None
class Team(BaseModel):
ip: str
name: str
highlighted: bool = False
class BasicConfig(BaseModel):
admin: Optional[AdminConfig] = None
game: GameConfig
tasks: List[Task]
teams: List[Team]
class Config(BasicConfig):
admin: AdminConfig
storages: StoragesConfig