Add secret_settings and mechanisms for managing it. This allows for easier hiding game- and server-specific settings when sharing the game dir with others.

This commit is contained in:
Griatch 2017-06-04 22:55:28 +02:00
parent b269ef265e
commit 167d09b4cd
5 changed files with 50 additions and 24 deletions

View file

@ -25,9 +25,9 @@ __pycache__
*.restart
*.db3
# Installation-specific.
# Installation-specific.
# For group efforts, comment out some or all of these.
server/conf/settings.py
server/conf/secret_settings.py
server/logs/*.log.*
web/static/*
web/media/*

View file

@ -0,0 +1,17 @@
"""
This file is meant for when you want to share your game dir with
others but don't want to share all details of your specific game
or local server setup. The settings in this file will override those
in settings.py and is in .gitignore by default.
A good guideline when sharing your game dir is that you want your
game to run correctly also without this file and only use this
to override your public, shared settings.
"""
# The secret key is randomly seeded upon creation. It is used to sign
# Django's cookies and should not be publicly known. It should also
# generally not be changed once people have registered with the game
# since it will invalidate their existing sessions.
SECRET_KEY = {secret_key}

View file

@ -19,6 +19,9 @@ paths (path.to.module) should be given relative to the game's root
folder (typeclasses.foo) whereas paths within the Evennia library
needs to be given explicitly (evennia.foo).
If you want to share your game dir, including its settings, you can
put secret game- or server-specific settings in secret_settings.py.
"""
# Use the defaults from Evennia unless explicitly overridden
@ -31,13 +34,11 @@ from evennia.settings_default import *
# This is the name of your game. Make it catchy!
SERVERNAME = {servername}
######################################################################
# Django web features
######################################################################
# The secret key is randomly seeded upon creation. It is used to sign
# Django's cookies. Do not share this with anyone. Changing it will
# log out all active web browsing sessions. Game web client sessions
# may survive.
SECRET_KEY = {secret_key}
######################################################################
# Settings given in secret_settings.py override those in this file.
######################################################################
try:
from server.conf.secret_settings import *
except ImportError:
print "secret_settings.py file not found or failed to import."