<commit_before>import os

# Default values for production, may be overridden later based on environment
class FlaskConfig(object):
    DEBUG = False
    TESTING = False
    WTF_CSRF_ENABLED = True

# Use different secret keys for the two different applications so their
# sessions can't be confused.
# TODO consider using salts instead: http://pythonhosted.org//itsdangerous/#the-salt
class SourceInterfaceFlaskConfig(FlaskConfig):
    SECRET_KEY = '<KEY>

class JournalistInterfaceFlaskConfig(FlaskConfig):
    SECRET_KEY = '<KEY>

# These files are in the same directory as config.py. Use absolute paths to
# avoid potential problems with the test runner - otherwise, you have to be in
# this directory when you run the code.
SECUREDROP_ROOT = os.path.dirname(os.path.realpath(__file__))

SOURCE_TEMPLATES_DIR = os.path.join(SECUREDROP_ROOT, 'source_templates')
JOURNALIST_TEMPLATES_DIR = os.path.join(SECUREDROP_ROOT, 'journalist_templates')
WORD_LIST = os.path.join(SECUREDROP_ROOT, 'wordlist')
NOUNS = os.path.join(SECUREDROP_ROOT, 'dictionaries/nouns.txt')
ADJECTIVES = os.path.join(SECUREDROP_ROOT, './dictionaries/adjectives.txt')

JOURNALIST_PIDFILE = "/tmp/journalist.pid"
SOURCE_PIDFILE = "/tmp/source.pid"

# "head -c 32 /dev/urandom | base64" for constructing public ID from source codename
SCRYPT_ID_PEPPER = '4TpWpD3qvJvaYq5LgjuoAGfWio6o69pfOWKiue1ZVu8='
# "head -c 32 /dev/urandom | base64" for stretching source codename into GPG passphrase
SCRYPT_GPG_PEPPER = '<KEY>LIsgOv/Ql9TjLmQnZ<KEY>='
SCRYPT_PARAMS = dict(N=2**14, r=8, p=1)

# Fingerprint of the public key to use for encrypting submissions
# Defaults to test_journalist_key.pub, which is used for development and testing
JOURNALIST_KEY = '<KEY>'

# Directory where SecureDrop stores the database file, GPG keyring, and
# encrypted submissions.
SECUREDROP_DATA_ROOT = '/var/lib/securedrop'

# Modify configuration for alternative environments
env = os.environ.get('SECUREDROP_ENV') or 'prod'

if env == 'prod':
    pass
elif env == 'dev':
    # Enable Flask's debugger for development
    FlaskConfig.DEBUG = True
    # Hack to get around cookies not considering the port as part of the origin
    SourceInterfaceFlaskConfig.SESSION_COOKIE_NAME = 'source_session'
    JournalistInterfaceFlaskConfig.SESSION_COOKIE_NAME = 'journalist_session'
elif env == 'test':
    FlaskConfig.TESTING = True
    # Disable CSRF checks for tests to make writing tests easier
    FlaskConfig.WTF_CSRF_ENABLED = False
    # TODO use a unique temporary directory for each test so we can parallelize them
    SECUREDROP_DATA_ROOT = '/tmp/securedrop'

# The following configuration is dependent on SECUREDROP_DATA_ROOT

# Directory where encrypted submissions are stored
STORE_DIR=os.path.join(SECUREDROP_DATA_ROOT, 'store')

# Directory where GPG keyring is stored
GPG_KEY_DIR=os.path.join(SECUREDROP_DATA_ROOT, 'keys')

# Database configuration
# TODO we currently use sqlite in production since it is sufficient and simple,
# but in the future may want to be able to choose a different database
# depending on the environment
DATABASE_ENGINE = 'sqlite'
DATABASE_FILE = os.path.join(SECUREDROP_DATA_ROOT, 'db.sqlite')
<commit_msg>Update ansible's copy of config.py<commit_after>import os

# Default values for production, may be overridden later based on environment
class FlaskConfig(object):
    DEBUG = False
    TESTING = False
    WTF_CSRF_ENABLED = True

# Use different secret keys for the two different applications so their
# sessions can't be confused.
# TODO consider using salts instead: http://pythonhosted.org//itsdangerous/#the-salt
class SourceInterfaceFlaskConfig(FlaskConfig):
    SECRET_KEY = '<KEY>

class JournalistInterfaceFlaskConfig(FlaskConfig):
    SECRET_KEY = '<KEY>

# These files are in the same directory as config.py. Use absolute paths to
# avoid potential problems with the test runner - otherwise, you have to be in
# this directory when you run the code.
SECUREDROP_ROOT = os.path.dirname(os.path.realpath(__file__))

SOURCE_TEMPLATES_DIR = os.path.join(SECUREDROP_ROOT, 'source_templates')
JOURNALIST_TEMPLATES_DIR = os.path.join(SECUREDROP_ROOT, 'journalist_templates')
WORD_LIST = os.path.join(SECUREDROP_ROOT, 'wordlist')
NOUNS = os.path.join(SECUREDROP_ROOT, 'dictionaries/nouns.txt')
ADJECTIVES = os.path.join(SECUREDROP_ROOT, './dictionaries/adjectives.txt')

JOURNALIST_PIDFILE = "/tmp/journalist.pid"
SOURCE_PIDFILE = "/tmp/source.pid"

# "head -c 32 /dev/urandom | base64" for constructing public ID from source codename
SCRYPT_ID_PEPPER = '4TpWpD3qvJvaYq5LgjuoAGfWio6o69pfOWKiue1ZVu8='
# "head -c 32 /dev/urandom | base64" for stretching source codename into GPG passphrase
SCRYPT_GPG_PEPPER = 'bBizEs8qjZrLIsgOv/Ql9TjLmQnZykMU4kQfsNjSFN4='
SCRYPT_PARAMS = dict(N=2**14, r=8, p=1)

# Fingerprint of the public key to use for encrypting submissions
# Defaults to test_journalist_key.pub, which is used for development and testing
JOURNALIST_KEY = '<KEY>'

# Directory where SecureDrop stores the database file, GPG keyring, and
# encrypted submissions.
SECUREDROP_DATA_ROOT = '/var/lib/securedrop'

# Modify configuration for alternative environments
env = os.environ.get('SECUREDROP_ENV') or 'prod'

if env == 'prod':
    # This is recommended for performance, and also resolves #369
    FlaskConfig.USE_X_SENDFILE = True
elif env == 'dev':
    # Enable Flask's debugger for development
    FlaskConfig.DEBUG = True
    # Hack to get around cookies not considering the port as part of the origin
    SourceInterfaceFlaskConfig.SESSION_COOKIE_NAME = 'source_session'
    JournalistInterfaceFlaskConfig.SESSION_COOKIE_NAME = 'journalist_session'
elif env == 'test':
    FlaskConfig.TESTING = True
    # Disable CSRF checks to make writing tests easier
    FlaskConfig.WTF_CSRF_ENABLED = False
    # TODO use a unique temporary directory for each test so we can parallelize them
    SECUREDROP_DATA_ROOT = '/tmp/securedrop'

# The following configuration is dependent on SECUREDROP_DATA_ROOT

# Directory where encrypted submissions are stored
STORE_DIR=os.path.join(SECUREDROP_DATA_ROOT, 'store')

# Directory where GPG keyring is stored
GPG_KEY_DIR=os.path.join(SECUREDROP_DATA_ROOT, 'keys')

# Database configuration
# TODO we currently use sqlite in production since it is sufficient and simple,
# but in the future may want to be able to choose a different database
# depending on the environment
DATABASE_ENGINE = 'sqlite'
DATABASE_FILE = os.path.join(SECUREDROP_DATA_ROOT, 'db.sqlite')

{'fraction_non_alphanumeric': 0.07963647566235367, 'fraction_numerical': 0.007701786814540973, 'mean_word_length': 5.2372718539865515, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '680340', 'n_tokens_mistral': 2165, 'n_tokens_neox': 2108, 'n_words': 626}