[manual] Switch over to new /etc/zulip/zulip.conf config file

Run the following commands as root before deploying this branch:
 # /root/zulip/tools/migrate-server-config
 # rm /etc/zulip/machinetype /etc/zulip/server /etc/zulip/local /etc/humbug-machinetype /etc/humbug-server /etc/humbug-local

(imported from commit aa7dcc50d2f4792ce33834f14761e76512fca252)
This commit is contained in:
Zev Benjamin
2013-10-31 19:00:30 -04:00
parent e9bd56b5a0
commit 787215d743
10 changed files with 64 additions and 49 deletions

View File

@@ -5,19 +5,22 @@
import os
import platform
import time
import re
import sys
import ConfigParser
from zerver.openid import openid_failure_handler
config_file = ConfigParser.RawConfigParser()
config_file.read("/etc/zulip/zulip.conf")
# Whether we're running in a production environment. Note that DEPLOYED does
# **not** mean hosted by us; customer sites are DEPLOYED and LOCAL_SERVER
# and as such should not for example assume they are the main Zulip site.
DEPLOYED = os.path.exists('/etc/zulip/server')
STAGING_DEPLOYED = (platform.node() == 'staging.zulip.net')
TESTING_DEPLOYED = not not re.match(r'^test', platform.node())
DEPLOYED = config_file.has_option('machine', 'deploy_type')
STAGING_DEPLOYED = DEPLOYED and config_file.get('machine', 'deploy_type') == 'staging'
TESTING_DEPLOYED = DEPLOYED and config_file.get('machine', 'deploy_type') == 'test'
LOCAL_SERVER = os.path.exists('/etc/zulip-local')
LOCAL_SERVER = DEPLOYED and config_file.get('machine', 'deploy_type') == 'local'
# TODO: Clean this up
if TESTING_DEPLOYED: