forked from PyPlanet/PyPlanet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker_base.py
114 lines (98 loc) · 3.83 KB
/
docker_base.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
"""
This file contains the basic settings and overrides the default ones that are defined in the core.
Documentation: http://pypla.net/
If you want to use other configuration methods like YAML or JSON files, take a look at http://pypla.net/ and head to the
configuration pages.
"""
import os
# Set the root_path to the root of our project.
ROOT_PATH = os.path.dirname(os.path.dirname(__file__))
# Set the temporary location for the project.
TMP_PATH = os.path.join(ROOT_PATH, 'tmp')
# Create temporary folder if not exists.
if not os.path.exists(TMP_PATH):
os.mkdir(TMP_PATH)
# Enable debug mode to get verbose output, not report any errors and dynamically use the DEBUG in your code
# for extra verbosity of logging/output.
DEBUG = bool(os.environ.get('PYPLANET_DEBUG', False))
# Add your pools (the controller instances per dedicated here) or leave as it is to use a single instance only.
POOLS = [
'default'
]
# Owners are logins of the server owners, the owners always get *ALL* the permissions in the system.
OWNERS = {
'default': [
os.getenv('MANIAPLANET_OWNER_LOGIN', '')
]
}
# Allow self-upgrading the installation. Disable on shared servers with one installation (hosting environment)!
SELF_UPGRADE = False
# Databases configuration holds an dictionary with information of the database backend.
# Please refer to the documentation for all examples. http://pypla.net/
if os.environ.get('MYSQL_HOST') is not None:
DATABASES = {
'default': {
'ENGINE': 'peewee_async.MySQLDatabase',
'NAME': os.getenv('MYSQL_DATABASE', 'pyplanet'),
'OPTIONS': {
'host': os.getenv('MYSQL_HOST', 'db'),
'user': os.getenv('MYSQL_USER', 'pyplanet'),
'password': os.getenv('MYSQL_PASSWORD', 'pyplanet'),
'charset': 'utf8mb4',
}
}
}
elif os.environ.get('POSTGRES_HOST') is not None:
DATABASES = {
'default': {
'ENGINE': 'peewee_async.PostgresqlDatabase',
'NAME': os.getenv('POSTGRES_DB', 'pyplanet'),
'OPTIONS': {
'host': os.getenv('POSTGRES_HOST', 'db'),
'user': os.getenv('POSTGRES_USER', 'pyplanet'),
'password': os.getenv('POSTGRES_PASSWORD', 'pyplanet'),
'autocommit': 'True',
}
}
}
# Dedicated configuration holds the different dedicated servers that the instances will run on including the names of
# the instances.
DEDICATED = {
'default': {
'HOST': os.getenv('MANIAPLANET_HOST', 'dedicated'),
'PORT': os.getenv('MANIAPLANET_PORT', '5000'),
'USER': os.getenv('MANIAPLANET_USER', 'SuperAdmin'),
'PASSWORD': os.getenv('MANIAPLANET_PASSWORD', 'SuperAdmin'),
}
}
# Map configuration is a set of configuration options related to match settings etc.
# Matchsettings filename.
MAP_MATCHSETTINGS = {
'default': 'maplist.txt',
}
# Blacklist file is managed by the dedicated server and will be loaded and writen to by PyPlanet once a
# player gets blacklisted. The default will be the filename Maniaplanet always uses and is generic.
BLACKLIST_FILE = {
'default': 'blacklist.txt'
}
# The storage configuration contains the same instance mapping of the dedicated servers and is used
# to access the filesystem on the dedicated server location.
# Please refer to the documentation for more information. http://pypla.net/
STORAGE = {
'default': {
'DRIVER': 'pyplanet.core.storage.drivers.local.LocalDriver',
'OPTIONS': {},
}
}
# Define any cache backends that can be used by the core and the plugins to cache data.
# This is not yet implemented. As soon as it's implemented you can activate it with the documentation, available on
# http://pypla.net/
# CACHE = {
# 'default': {
#
# }
# }
# Songs is a list of URLs to .ogg files of songs to be played by the music server.
SONGS = {
'default': []
}