ColdCore/config.py

86 lines
2.3 KiB
Python
Raw Normal View History

import os
from datetime import datetime
2016-07-15 20:37:03 +00:00
production = os.getenv("PRODUCTION", None) is not None
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
2016-07-15 20:37:03 +00:00
2016-07-09 14:42:07 +00:00
ctf_name = "IceCTF"
2016-07-31 18:39:19 +00:00
eligibility = "In order to be eligible for prizes, all members of your team must be Icelandic residents, and you must not have more than three team members."
tagline = "The Icelandic Hacking Competition"
2016-08-05 20:08:25 +00:00
# IRC Channel
2016-07-09 14:42:07 +00:00
ctf_chat_channel = "#IceCTF"
2016-07-09 15:07:41 +00:00
ctf_home_url = "https://icec.tf"
2016-07-31 18:39:19 +00:00
# Serve javascript libraries from CDN
2016-02-04 01:20:39 +00:00
cdn = True
2016-07-31 18:39:19 +00:00
# Allow users to submit via an api?
2015-11-12 03:41:04 +00:00
apisubmit = True
2016-07-31 18:39:19 +00:00
# Allow registration?
2016-04-17 16:33:42 +00:00
registration = True
2016-07-31 18:39:19 +00:00
# If running behind proxy (nginx), which header contains the real IP
2015-11-08 06:10:26 +00:00
proxied_ip_header = "X-Forwarded-For"
2016-07-31 18:39:19 +00:00
# How many teams to show on the scoreboard graph
2015-11-08 19:04:02 +00:00
teams_on_graph = 10
2016-07-31 18:39:19 +00:00
# Which email to send out notifications from
2016-07-14 17:46:46 +00:00
mail_from = "notice@icec.tf"
2016-07-31 18:39:19 +00:00
# Wether to render the scoreboard on request or cache
2016-05-27 01:58:31 +00:00
immediate_scoreboard = False
2016-07-31 18:39:19 +00:00
# Banned email domains
disallowed_domain = "icec.tf"
2016-05-15 22:05:42 +00:00
2016-07-31 18:39:19 +00:00
# Where the static stuff is stored
2016-08-05 20:08:25 +00:00
static_prefix = "/problem-static/"
static_dir = "{}/problem_static/".format(os.path.dirname(os.path.abspath(__file__)))
2016-07-10 16:15:33 +00:00
custom_stylesheet = "css/main.css"
2015-11-08 19:04:02 +00:00
2016-07-31 18:39:19 +00:00
# Shell accounts?
enable_shell = True
shell_port = 22
2016-08-12 10:01:31 +00:00
shell_host = "shell.icec.tf"
2016-07-31 18:39:19 +00:00
2016-08-05 20:08:25 +00:00
shell_user_prefixes = ["ctf-"]
2016-08-12 10:03:49 +00:00
shell_password_length = 8
2016-07-31 18:39:19 +00:00
shell_free_acounts = 10
shell_max_accounts = 99999
shell_user_creation = "sudo useradd -m {username} -p {password} -g ctf -b /home_users"
2016-08-12 09:49:41 +00:00
2016-07-31 18:39:19 +00:00
# when the competition begins
competition_begin = datetime(1970, 1, 1, 0, 0)
2016-02-03 22:31:14 +00:00
competition_end = datetime(2018, 1, 1, 0, 0)
2016-07-15 22:07:02 +00:00
if production:
competition_begin = datetime(2016, 8, 12, hour=16, minute=0, second=0)
competition_end = datetime(2016, 8, 26, hour=16, minute=0, second=0)
2016-05-15 22:05:42 +00:00
def competition_is_running():
return competition_begin < datetime.now() < competition_end
2015-11-08 19:04:02 +00:00
# Don't touch these. Instead, copy secrets.example to secrets and edit that.
import yaml
from collections import namedtuple
with open("secrets") as f:
_secret = yaml.load(f)
secret = namedtuple('SecretsDict', _secret.keys())(**_secret)
2016-07-15 20:37:03 +00:00
_redis = {
'host': 'localhost',
'port': 6379,
'db': 0
}
if production:
with open("database") as f:
_database = yaml.load(f)
database = namedtuple('DatabaseDict', _database.keys())(**_database)
_redis['db'] = 1
redis = namedtuple('RedisDict', _redis.keys())(**_redis)