1# Warning! Servers will not update or merge with the version controlled copy of 2# this file, so any parameters here, and code that uses them, need to come 3# without the assumption that they will be present in any given config.py on a 4# server. Furthermore, on a typical rebuild in a production server, a running 5# webtiles server *will not restart*, so you can't even assume that any config- 6# specific code that you've added will be consistently present. This 7# particularly impacts templated html files, which are loaded and called 8# dynamically, so *do* get updated immediately on a rebuild. If something like 9# client.html raises an exception, this will trigger 500 errors across the whole 10# server. 11# 12# One useful workaround for all this is to get config paramters with the builtin 13# `getattr` function: e.g. `getattr(config, "dgl_mode", False) will safely get 14# this variable from the module, defaulting to False if it doesn't exist (and 15# not raising an exception). `hasattr` is also safe. 16 17import logging 18import os 19 20import yaml 21 22try: 23 from collections import OrderedDict 24except ImportError: 25 from ordereddict import OrderedDict # type: ignore 26 27 28dgl_mode = True 29 30bind_nonsecure = True # Set to false to only use SSL 31bind_address = "" 32bind_port = 8080 33# Or listen on multiple address/port pairs (overriding the above) with: 34# bind_pairs = ( 35# ("127.0.0.1", 8080), 36# ("localhost", 8082), 37# ("", 8180), # All addresses 38# ) 39 40logging_config = { 41# "filename": "webtiles.log", 42 "level": logging.INFO, 43 "format": "%(asctime)s %(levelname)s: %(message)s" 44} 45 46password_db = "./webserver/passwd.db3" 47# Uncomment and change if you want this db somewhere separate from the 48# password_db location. 49#settings_db = "./webserver/user_settings.db3" 50 51static_path = "./webserver/static" 52template_path = "./webserver/templates/" 53 54# Path for server-side unix sockets (to be used to communicate with crawl) 55server_socket_path = None # Uses global temp dir 56 57# Server name, so far only used in the ttyrec metadata 58server_id = "" 59 60# Disable caching of game data files 61game_data_no_cache = True 62 63# Watch socket dirs for games not started by the server 64watch_socket_dirs = False 65 66use_game_yaml = True 67 68# Game configs 69# 70# You can define game configs in two ways: 71# 1. With a static dictionary `games` 72# 2. As extra games to append to this list from `load_games.load_games` (which 73# by default loads games as defined in `games.d/*.yaml`). 74# 75# All options in this config are documented in games.d/base.yaml. 76games = OrderedDict([ 77 ("dcss-web-trunk", dict( 78 name = "Play trunk", 79 crawl_binary = "./crawl", 80 rcfile_path = "./rcs/", 81 macro_path = "./rcs/", 82 morgue_path = "./rcs/%n", 83 inprogress_path = "./rcs/running", 84 ttyrec_path = "./rcs/ttyrecs/%n", 85 socket_path = "./rcs", 86 client_path = "./webserver/game_data/", 87 # dir_path = ".", 88 # cwd = ".", 89 morgue_url = None, 90 show_save_info = True, 91 # milestone_path = "./rcs/milestones", 92 send_json_options = True, 93 # env = {"LANG": "en_US.UTF8"}, 94 )), 95]) 96 97 98dgl_status_file = "./rcs/status" 99 100# Extra paths to tail for milestone updates. This is a legacy setting, you 101# should use `milestone_path` or `dir_path` for each game in the games dict. 102# (This setting can be a string or list of strings.) 103milestone_file = ["./milestones"] 104 105status_file_update_rate = 5 106 107recording_term_size = (80, 24) 108 109max_connections = 100 110 111# Script to initialize a user, e.g. make sure the paths 112# and the rc file exist. This is not done by the server 113# at the moment. 114init_player_program = "./util/webtiles-init-player.sh" 115 116ssl_options = None # No SSL 117#ssl_options = { 118# "certfile": "./webserver/localhost.crt", 119# "keyfile": "./webserver/localhost.key" 120#} 121ssl_address = "" 122ssl_port = 8081 123# Or listen on multiple address/port pairs (overriding the above) with: 124# ssl_bind_pairs = ( 125# ("127.0.0.1", 8081), 126# ("localhost", 8083), 127# ) 128 129connection_timeout = 600 130max_idle_time = 5 * 60 * 60 131 132use_gzip = True 133 134# Seconds until stale HTTP connections are closed 135# This needs a patch currently not in mainline tornado. 136http_connection_timeout = None 137 138# Set this to true if you are behind a reverse proxy 139# Your proxy must set header X-Real-IP 140# 141# Enabling this option when webtiles is NOT protected behind a reverse proxy 142# introduces a security risk. An attacker could inject a false address into the 143# X-Real-IP header. Do not enable this option if the webtiles server is 144# directly exposed to users. 145http_xheaders = None 146 147kill_timeout = 10 # Seconds until crawl is killed after HUP is sent 148 149nick_regex = r"^[a-zA-Z0-9]{3,20}$" 150max_passwd_length = 20 151 152# Set to True to allow users to request a password reset email. Some settings 153# must be properly configured for this to work: 154allow_password_reset = False 155# Set to True to allow dgl admin users to generate password reset tokens in the 156# admin panel. Only use if you really trust your admin users! 157admin_password_reset = False 158 159# Set to the primary URL where a player would reach the main lobby 160# For example: "http://crawl.akrasiac.org/" 161# This is required for for password reset, as it will be the base URL for 162# recovery URLs. Use "http://localhost:8080/" for testing. 163lobby_url = None 164 165# Proper SMTP settings are required for password reset to function properly. 166# if smtp_host is anything other than `localhost`, you may need to adjust the 167# timeout settings (see server.py, calls to ioloop.set_blocking_log_threshold). 168# TODO: set_blocking_log_threshold is deprecated in tornado 5+... 169# Ideally, test out these settings carefully in a non-production setting 170# before enabling this, as there's a bunch of ways for this to go wrong and you 171# don't want to get your SMTP server blacklisted. 172smtp_host = "localhost" 173smtp_port = 25 174smtp_use_ssl = False 175smtp_user = "" # set to None for no auth 176smtp_password = "" 177smtp_from_addr = "noreply@crawl.example.org" # The address from which automated 178 # emails will be sent 179 180# crypt() algorithm, e.g. "1" for MD5 or "6" for SHA-512; see crypt(3). If 181# false, use traditional DES (but then only the first eight characters of the 182# password are significant). If set to "broken", use traditional DES with 183# the password itself as the salt; this is necessary for compatibility with 184# dgamelaunch, but should be avoided if possible because it leaks the first 185# two characters of the password's plaintext. 186crypt_algorithm = "broken" 187 188# The length of the salt string to use. If crypt_algorithm is false, this 189# setting is ignored and the salt is two characters. 190crypt_salt_length = 16 191 192login_token_lifetime = 7 # Days 193 194uid = None # If this is not None, the server will setuid to that (numeric) id 195gid = None # after binding its sockets. 196 197umask = None # e.g. 0077 198 199chroot = None 200 201pidfile = None 202daemon = False # If true, the server will detach from the session after startup 203 204# Set to a URL with %s where lowercased player name should go in order to 205# hyperlink WebTiles spectator names to their player pages. 206# For example: "http://crawl.akrasiac.org/scoring/players/%s.html" 207# Set to None to disable player page hyperlinks 208player_url = None 209 210# Only for development: 211# This is insecure; do not set development_mode = True in production! 212development_mode = False 213 214# Disable caching of static files which are not part of game data. 215no_cache = development_mode 216# Automatically log in all users with the username given here. 217autologin = None 218