-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.py
177 lines (106 loc) · 5.04 KB
/
config.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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
"""
This defines constants used throughout the code.
This defines values that cannot be set with the Admin panel but are
"hard-coded" into the software.
Code regarding values set by the Admin panel can be found in
app.app.models.config.
A rebuild of the docker container is
required to implement changes from this file.
"""
import logging
############################
# Configuration variables: #
############################
# Logging:
LOGGING_LEVEL: int = logging.DEBUG
"""The log level (DEBUG, INFO, WARN, ERROR, FATAL)"""
LOGGING_FORMAT: str = "%(asctime)s : %(levelname)s : %(process)d => %(message)s"
"""The format for logging stuff, see Python's `logging` library"""
# Default Credentials:
DEFAULT_ADMIN_USERNAME: str = "admin"
"""This is the default first user"""
DEFAULT_ADMIN_PASSWORD: str = "12345"
"""This is the default password for the admin user.
This can be changed after the first login."""
# User interface stuff:
DEFAULT_THEME: str = "dark"
"""The *default* theme to use (users can change this individually)"""
# Defaults changable by the admin panel:
DEFAULT_HOME_DESCRIPTION: str = "Thunder. Time. Tech.<br>\nTeams compete with data to win."
"""A brief description of this whole thing which will appear on the home page
This can be changed by an admin user at any point during the competition!"""
DEFAULT_REG_CONFIRMATION: str = "Thank you for registering your team!<br>\nGood Luck!"
"""The screen that is shown when a team's registration is complete"""
DEFAULT_EMAIL_QUOTA: int = 2
"""The default maximum number of daily emails that can be sent by a team"""
# Scoring Scheme:
# For more config, check out the cubeserver_common.scoring package
# and cubeserver_common.models.config.rules
# Emails:
FROM_NAME: str = "The Project CubeServer"
"""The name with which most emails will be sent"""
FROM_ADDR: str = "noreply@whsproject.club"
"""The address from which most emails will be sent"""
# Contest names:
SHORT_TITLE: str = "CubeServer"
"""A short name that describes this software more than the prize"""
LONG_TITLE: str = "The Project"
"""A longer name that describes the prize. This should still be succinct."""
# Beacon:
DEFAULT_BEACON_POLLING_PERIOD: int = 10
"""The default period of the BeaconMessage collection polling in seconds"""
# Teams:
TEAM_MAX_CHARS: int = 30
"""Maximum number of characters in a team name"""
CHECK_PROFANITY: bool = True
"""Whether to check names, etc. for profanity."""
PROFANITY_MESSAGE: str = "Not Funny. \n" \
"We think you used some bad words in your input. \n" \
"Profanity is not allowed by the administrator."
"""The message to use if profanity is detected in the user's input"""
TEAM_SECRET_LENGTH: int = 16
"""Number of characters in teams' secret IDs"""
INTERNAL_SECRET_LENGTH: int = 32
"""Number of characters in internal teams' secret IDs"""
TEAM_MAX_UPDATE_LENGTH: int = 32768 # 32KiB
"""Maximum length of a team's code update"""
# Internal Teams (for extending api functionality for behind-the-scenes use):
BEACON_TEAM_NAME: str = "CubeServer-beacon"
"""The name of the "team" for the beacon"""
REFERENCE_TEAM_NAME: str = "CubeServer-reference-{}"
"""The naming pattern for reference "team"s"""
REFERENCE_PORT_RANGE: tuple[int] = (32770, 32870)
"""Ports allocated to the reference server"""
REFERENCE_COMMAND_PORT: int = 32769
"""The port to which reference commands are sent to be dispatched to stations"""
# Cubes:
COMMENT_FILTER_PROFANITY: bool = True
"""Whether to filter profanity from comments posted by the cubes"""
# Behind-the-scenes stuff - this could easily make stuff break -
# Kindly leave this alone unless you know what you're doing ;)
ENCODING: str = "utf-8"
"""The string encoding to use by default in cases where this matters
Please don't change this in an existing setup unless you understand
that it may render all user passwords and tokens invalidated. :) """
SECRET_KEY_FILE: str = "/secret/secret_key.txt"
"""Where the value of flask's config variable SECRET_KEY is stored.
This should be in the .gitignore for good practice.
Also, this MUST correspond with the volume mounted in docker-compose.yml
so that the secret key can be persistent across rebuilds and not invalidate
everyone's passwords and connections, since that would be really bad in
a production environment."""
SECRET_KEY_FILE_ENCODING: str = ENCODING
"""The encoding to use for the file which will store flask's SECRET_KEY"""
PASSWORD_HASH_ALGORITHM: str = "sha3_512"
"""Which algorithm to use for user (admin) passwords and crypto purposes within the web app
This *MUST* be present in hashlib.algorithms_available or things will break!"""
CRYPTO_HASH_ALGORITHM: str = "sha3_512"
"""Which algorithm to use for crypto purposes as far as authenticating the teams' data.
This *MUST* be present in hashlib.algorithms_available or things will break!"""
TEMP_PATH: str = "/tmp/"
"""A path to a temporary directory that will not be persistent"""
########################
# Generated #
########################
# Contributors (loaded from AUTHORS.yaml):
CONTRIBUTORS_YAML: str