<commit_before>import os
import re
import sys
from functools import wraps
from getpass import getpass, getuser
from glob import glob
from contextlib import contextmanager
from posixpath import join

from fabric.api import env, cd, prefix, sudo as _sudo, run as _run, hide, task
from fabric.contrib.files import exists, upload_template
from fabric.colors import yellow, green, blue, red

from utils import BotoConnection
boto = BotoConnection(region='us-east-1')

################
# Config setup #
################

from settings import FABRIC as conf
conf.update({"HOSTS":boto.get_ec2_hosts()})

env.db_pass = conf.get("DB_PASS", os.environ.get("DB_PASS", None))
env.db_name = conf.get("DB_NAME", boto.get_rds_dbname())
env.db_user = conf.get("DB_USER", boto.get_rds_username())
env.db_host = conf.get("DB_HOST", boto.get_rds_host())
env.db_port = conf.get("DB_PORT", boto.get_rds_port())
env.admin_pass = conf.get("ADMIN_PASS", os.environ.get("ADMIN_PASS", None))
env.user = conf.get("SSH_USER", os.environ.get("SSH_USER", getuser()))
env.key_filename = conf.get("SSH_KEY_PATH", os.environ.get("SSH_KEY_PATH", None))
env.hosts = conf.get("HOSTS", [])

env.proj_name = conf.get("PROJECT_NAME", os.getcwd().split(os.sep)[-1])
env.venv_home = conf.get("VIRTUALENV_HOME", "/home/%s" % env.user)
env.venv_path = "%s/%s" % (env.venv_home, env.proj_name)
env.proj_dirname = "project"
env.proj_path = "%s/%s" % (env.venv_path, env.proj_dirname)
env.manage = "%s/bin/python %s/project/manage.py" % (env.venv_path,
                                                     env.venv_path)
env.live_host = conf.get("LIVE_HOSTNAME", env.hosts[0] if env.hosts else None)
env.repo_url = conf.get("REPO_URL", os.environ.get("REPO_URL", ""))
env.reqs_path = conf.get("REQUIREMENTS_PATH", os.environ.get("REQUIREMENTS_PATH", None))
env.gunicorn_port = conf.get("GUNICORN_PORT", 8000)
env.locale = conf.get("LOCALE", "en_US.UTF-8")

env.secret_key = conf.get("SECRET_KEY", "")
env.nevercache_key = conf.get("NEVERCACHE_KEY", "")


##################
# Template setup #
##################

# Each template gets uploaded at deploy time, only if their
# contents has changed, in which case, the reload command is
# also run.

templates = {
    "nginx": {
        "local_path": "deploy/nginx.conf",
        "remote_path": "/etc/nginx/sites-enabled/%(proj_name)s.conf",
        "reload_command": "service nginx restart",
    },
    "supervisor": {
        "local_path": "deploy/supervisor.conf",
        "remote_path": "/etc/supervisor/conf.d/%(proj_name)s.conf",
        "reload_command": "supervisorctl reload",
    },
    "cron": {<commit_msg>Get more secrets from environment<commit_after>import os
import re
import sys
from functools import wraps
from getpass import getpass, getuser
from glob import glob
from contextlib import contextmanager
from posixpath import join

from fabric.api import env, cd, prefix, sudo as _sudo, run as _run, hide, task
from fabric.contrib.files import exists, upload_template
from fabric.colors import yellow, green, blue, red

from utils import BotoConnection
boto = BotoConnection(region='us-east-1')

################
# Config setup #
################

from settings import FABRIC as conf
conf.update({"HOSTS":boto.get_ec2_hosts()})

env.db_pass = conf.get("DB_PASS", os.environ.get("DB_PASS", None))
env.db_name = conf.get("DB_NAME", boto.get_rds_dbname())
env.db_user = conf.get("DB_USER", boto.get_rds_username())
env.db_host = conf.get("DB_HOST", boto.get_rds_host())
env.db_port = conf.get("DB_PORT", boto.get_rds_port())
env.admin_pass = conf.get("ADMIN_PASS", os.environ.get("ADMIN_PASS", None))
env.user = conf.get("SSH_USER", os.environ.get("SSH_USER", getuser()))
env.key_filename = conf.get("SSH_KEY_PATH", os.environ.get("SSH_KEY_PATH", None))
env.hosts = conf.get("HOSTS", [])

env.proj_name = conf.get("PROJECT_NAME", os.getcwd().split(os.sep)[-1])
env.venv_home = conf.get("VIRTUALENV_HOME", "/home/%s" % env.user)
env.venv_path = "%s/%s" % (env.venv_home, env.proj_name)
env.proj_dirname = "project"
env.proj_path = "%s/%s" % (env.venv_path, env.proj_dirname)
env.manage = "%s/bin/python %s/project/manage.py" % (env.venv_path,
                                                     env.venv_path)
env.live_host = conf.get("LIVE_HOSTNAME", env.hosts[0] if env.hosts else None)
env.repo_url = conf.get("REPO_URL", os.environ.get("REPO_URL", ""))
env.reqs_path = conf.get("REQUIREMENTS_PATH", os.environ.get("REQUIREMENTS_PATH", None))
env.gunicorn_port = conf.get("GUNICORN_PORT", 8000)
env.locale = conf.get("LOCALE", "en_US.UTF-8")

env.secret_key = conf.get("SECRET_KEY", os.environ.get("SECRET_KEY",""))
env.nevercache_key = conf.get("NEVERCACHE_KEY", os.environ.get("NEVERCACHE_KEY", ""))


##################
# Template setup #
##################

# Each template gets uploaded at deploy time, only if their
# contents has changed, in which case, the reload command is
# also run.

templates = {
    "nginx": {
        "local_path": "deploy/nginx.conf",
        "remote_path": "/etc/nginx/sites-enabled/%(proj_name)s.conf",
        "reload_command": "service nginx restart",
    },
    "supervisor": {
        "local_path": "deploy/supervisor.conf",
        "remote_path": "/etc/supervisor/conf.d/%(proj_name)s.conf",
        "reload_command": "supervisorctl reload",
    },
    "cron": {
{'fraction_non_alphanumeric': 0.1801090430532055, 'fraction_numerical': 0.00338409475465313, 'mean_word_length': 4.576519916142558, 'pattern_counts': {'":': 20, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '554897', 'n_tokens_mistral': 1939, 'n_tokens_neox': 1895, 'n_words': 380}