mirror of https://github.com/zulip/zulip.git
generate-secrets: Refactor to make development/production explicit.
generate-secrets.py now requires --development for development environment setup or --production for production environment setup (and one of these options is mandatory). This solves the problem that it was somewhat easy to accidentally run generate-secrets.py without the `-d` option while doing manual development environment setup. Fixes: #1911.
This commit is contained in:
parent
01324f2afe
commit
d7253b144c
|
@ -65,7 +65,7 @@ if [ "$has_nginx" = 0 ]; then
|
|||
fi
|
||||
|
||||
if [ "$has_appserver" = 0 ]; then
|
||||
/root/zulip/scripts/setup/generate_secrets.py
|
||||
/root/zulip/scripts/setup/generate_secrets.py --production
|
||||
cp -a /root/zulip/zproject/prod_settings_template.py /etc/zulip/settings.py
|
||||
ln -nsf /etc/zulip/settings.py /root/zulip/zproject/prod_settings.py
|
||||
fi
|
||||
|
|
|
@ -15,7 +15,7 @@ os.environ['DJANGO_SETTINGS_MODULE'] = 'zproject.settings'
|
|||
from django.utils.crypto import get_random_string
|
||||
from six import text_type
|
||||
import six
|
||||
|
||||
import argparse
|
||||
from zerver.lib.str_utils import force_str
|
||||
from zerver.lib.utils import generate_random_token
|
||||
|
||||
|
@ -96,10 +96,10 @@ def generate_secrets(development=False):
|
|||
|
||||
if __name__ == '__main__':
|
||||
|
||||
development = False
|
||||
extra_args = sys.argv[1:]
|
||||
parser = argparse.ArgumentParser()
|
||||
group = parser.add_mutually_exclusive_group(required=True)
|
||||
group.add_argument('--development', action='store_true', dest='development', help='For setting up the developer env for zulip')
|
||||
group.add_argument('--production', action='store_false', dest='development', help='For setting up the production env for zulip')
|
||||
results = parser.parse_args()
|
||||
|
||||
if len(extra_args) and extra_args[0] in ('-d', '--development'):
|
||||
development = True
|
||||
|
||||
generate_secrets(development)
|
||||
generate_secrets(results.development)
|
||||
|
|
|
@ -184,7 +184,7 @@ def main():
|
|||
run(["tools/setup/install-phantomjs"])
|
||||
run(["tools/setup/download-zxcvbn"])
|
||||
run(["tools/setup/emoji_dump/build_emoji"])
|
||||
run(["scripts/setup/generate_secrets.py", "-d"])
|
||||
run(["scripts/setup/generate_secrets.py", "--development"])
|
||||
if TRAVIS and not PRODUCTION_TRAVIS:
|
||||
run(["sudo", "service", "rabbitmq-server", "restart"])
|
||||
run(["sudo", "service", "redis-server", "restart"])
|
||||
|
|
Loading…
Reference in New Issue