"""
sentry.options.defaults
~~~~~~~~~~~~~~~~~~~~~~~

:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import, print_function

from sentry.logging import LoggingFormat
from sentry.options import (
    FLAG_IMMUTABLE, FLAG_NOSTORE, FLAG_PRIORITIZE_DISK, FLAG_REQUIRED, FLAG_ALLOW_EMPTY,
    register,
)
from sentry.utils.types import Dict, String, Sequence

# Cache
# register('cache.backend', flags=FLAG_NOSTORE)
# register('cache.options', type=Dict, flags=FLAG_NOSTORE)

# System
register('system.admin-email', flags=FLAG_REQUIRED)
register('system.support-email', flags=FLAG_ALLOW_EMPTY | FLAG_PRIORITIZE_DISK)
register('system.security-email', flags=FLAG_ALLOW_EMPTY | FLAG_PRIORITIZE_DISK)
register('system.databases', type=Dict, flags=FLAG_NOSTORE)
# register('system.debug', default=False, flags=FLAG_NOSTORE)
register('system.rate-limit', default=0, flags=FLAG_ALLOW_EMPTY | FLAG_PRIORITIZE_DISK)
register('system.secret-key', flags=FLAG_NOSTORE)
# Absolute URL to the sentry root directory. Should not include a trailing slash.
register('system.url-prefix', ttl=60, grace=3600, flags=FLAG_REQUIRED | FLAG_PRIORITIZE_DISK)
register('system.root-api-key', flags=FLAG_PRIORITIZE_DISK)
register('system.logging-format', default=LoggingFormat.HUMAN, flags=FLAG_NOSTORE)

# Redis
register(
    'redis.clusters',
    type=Dict,
    default={
        'default': {
            'hosts': {
                0: {
                    'host': '127.0.0.1',
                    'port': 6379,
                }
            },
        },
    },
    flags=FLAG_NOSTORE | FLAG_IMMUTABLE
)
register('redis.options', type=Dict, flags=FLAG_NOSTORE)

# symbolizer specifics
register('dsym.cache-path', type=String, default='/tmp/sentry-dsym-cache')

# Mail
register('mail.backend', default='smtp', flags=FLAG_NOSTORE)
register('mail.host', default='localhost', flags=FLAG_REQUIRED | FLAG_PRIORITIZE_DISK)
register('mail.port', default=25, flags=FLAG_REQUIRED | FLAG_PRIORITIZE_DISK)
register('mail.username', flags=FLAG_REQUIRED | FLAG_ALLOW_EMPTY | FLAG_PRIORITIZE_DISK)
register('mail.password', flags=FLAG_REQUIRED | FLAG_ALLOW_EMPTY | FLAG_PRIORITIZE_DISK)
register('mail.use-tls', default=False, flags=FLAG_REQUIRED | FLAG_PRIORITIZE_DISK)
register('mail.subject-prefix', default='[Sentry] ', flags=FLAG_PRIORITIZE_DISK)
register('mail.from', default='root@localhost', flags=FLAG_REQUIRED | FLAG_PRIORITIZE_DISK)
register('mail.list-namespace', type=String, default='localhost', flags=FLAG_NOSTORE)
register('mail.enable-replies', default=False, flags=FLAG_PRIORITIZE_DISK)
register('mail.reply-hostname', default='', flags=FLAG_ALLOW_EMPTY | FLAG_PRIORITIZE_DISK)
register('mail.mailgun-api-key', default='', flags=FLAG_ALLOW_EMPTY | FLAG_PRIORITIZE_DISK)

# SMS
register('sms.twilio-account', default='', flags=FLAG_ALLOW_EMPTY | FLAG_PRIORITIZE_DISK)
register('sms.twilio-token', default='', flags=FLAG_ALLOW_EMPTY | FLAG_PRIORITIZE_DISK)
register('sms.twilio-number', default='', flags=FLAG_ALLOW_EMPTY | FLAG_PRIORITIZE_DISK)

# U2F
register('u2f.app-id', default='', flags=FLAG_ALLOW_EMPTY | FLAG_PRIORITIZE_DISK)
register('u2f.facets', default=(), type=Sequence,
         flags=FLAG_ALLOW_EMPTY | FLAG_PRIORITIZE_DISK)

register('auth.ip-rate-limit', default=0, flags=FLAG_ALLOW_EMPTY | FLAG_PRIORITIZE_DISK)
register('auth.user-rate-limit', default=0, flags=FLAG_ALLOW_EMPTY | FLAG_PRIORITIZE_DISK)

register('api.rate-limit.org-create', default=5, flags=FLAG_ALLOW_EMPTY | FLAG_PRIORITIZE_DISK)

# Filestore
register('filestore.backend', default='filesystem', flags=FLAG_NOSTORE)
register('filestore.options', default={'location': '/tmp/sentry-files'}, flags=FLAG_NOSTORE)

[((589, 640), 'sentry.options.register', 'register', (['"""system.admin-email"""'], {'flags': 'FLAG_REQUIRED'}), "('system.admin-email', flags=FLAG_REQUIRED)\n", (597, 640), False, 'from sentry.options import FLAG_IMMUTABLE, FLAG_NOSTORE, FLAG_PRIORITIZE_DISK, FLAG_REQUIRED, FLAG_ALLOW_EMPTY, register\n'), ((641, 720), 'sentry.options.register', 'register', (['"""system.support-email"""'], {'flags': '(FLAG_ALLOW_EMPTY | FLAG_PRIORITIZE_DISK)'}), "('system.support-email', flags=FLAG_ALLOW_EMPTY | FLAG_PRIORITIZE_DISK)\n", (649, 720), False, 'from sentry.options import FLAG_IMMUTABLE, FLAG_NOSTORE, FLAG_PRIORITIZE_DISK, FLAG_REQUIRED, FLAG_ALLOW_EMPTY, register\n'), ((721, 806), 'sentry.options.register', 'register', (['"""system.security-email"""'], {'flags': '(FLAG_ALLOW_EMPTY | FLAG_PRIORITIZE_DISK)'}), "('system.security-email', flags=FLAG_ALLOW_EMPTY | FLAG_PRIORITIZE_DISK\n    )\n", (729, 806), False, 'from sentry.options import FLAG_IMMUTABLE, FLAG_NOSTORE, FLAG_PRIORITIZE_DISK, FLAG_REQUIRED, FLAG_ALLOW_EMPTY, register\n'), ((802, 861), 'sentry.options.register', 'register', (['"""system.databases"""'], {'type': 'Dict', 'flags': 'FLAG_NOSTORE'}), "('system.databases', type=Dict, flags=FLAG_NOSTORE)\n", (810, 861), False, 'from sentry.options import FLAG_IMMUTABLE, FLAG_NOSTORE, FLAG_PRIORITIZE_DISK, FLAG_REQUIRED, FLAG_ALLOW_EMPTY, register\n'), ((924, 1015), 'sentry.options.register', 'register', (['"""system.rate-limit"""'], {'default': '(0)', 'flags': '(FLAG_ALLOW_EMPTY | FLAG_PRIORITIZE_DISK)'}), "('system.rate-limit', default=0, flags=FLAG_ALLOW_EMPTY |\n    FLAG_PRIORITIZE_DISK)\n", (932, 1015), False, 'from sentry.options import FLAG_IMMUTABLE, FLAG_NOSTORE, FLAG_PRIORITIZE_DISK, FLAG_REQUIRED, FLAG_ALLOW_EMPTY, register\n'), ((1012, 1061), 'sentry.options.register', 'register', (['"""system.secret-key"""'], {'flags': 'FLAG_NOSTORE'}), "('system.secret-key', flags=FLAG_NOSTORE)\n", (1020, 1061), False, 'from sentry.options import FLAG_IMMUTABLE, FLAG_NOSTORE, FLAG_PRIORITIZE_DISK, FLAG_REQUIRED, FLAG_ALLOW_EMPTY, register\n'), ((1144, 1241), 'sentry.options.register', 'register', (['"""system.url-prefix"""'], {'ttl': '(60)', 'grace': '(3600)', 'flags': '(FLAG_REQUIRED | FLAG_PRIORITIZE_DISK)'}), "('system.url-prefix', ttl=60, grace=3600, flags=FLAG_REQUIRED |\n    FLAG_PRIORITIZE_DISK)\n", (1152, 1241), False, 'from sentry.options import FLAG_IMMUTABLE, FLAG_NOSTORE, FLAG_PRIORITIZE_DISK, FLAG_REQUIRED, FLAG_ALLOW_EMPTY, register\n'), ((1238, 1297), 'sentry.options.register', 'register', (['"""system.root-api-key"""'], {'flags': 'FLAG_PRIORITIZE_DISK'}), "('system.root-api-key', flags=FLAG_PRIORITIZE_DISK)\n", (1246, 1297), False, 'from sentry.options import FLAG_IMMUTABLE, FLAG_NOSTORE, FLAG_PRIORITIZE_DISK, FLAG_REQUIRED, FLAG_ALLOW_EMPTY, register\n'), ((1298, 1385), 'sentry.options.register', 'register', (['"""system.logging-format"""'], {'default': 'LoggingFormat.HUMAN', 'flags': 'FLAG_NOSTORE'}), "('system.logging-format', default=LoggingFormat.HUMAN, flags=\n    FLAG_NOSTORE)\n", (1306, 1385), False, 'from sentry.options import FLAG_IMMUTABLE, FLAG_NOSTORE, FLAG_PRIORITIZE_DISK, FLAG_REQUIRED, FLAG_ALLOW_EMPTY, register\n'), ((1390, 1545), 'sentry.options.register', 'register', (['"""redis.clusters"""'], {'type': 'Dict', 'default': "{'default': {'hosts': {(0): {'host': '127.0.0.1', 'port': 6379}}}}", 'flags': '(FLAG_NOSTORE | FLAG_IMMUTABLE)'}), "('redis.clusters', type=Dict, default={'default': {'hosts': {(0): {\n    'host': '127.0.0.1', 'port': 6379}}}}, flags=FLAG_NOSTORE | FLAG_IMMUTABLE)\n", (1398, 1545), False, 'from sentry.options import FLAG_IMMUTABLE, FLAG_NOSTORE, FLAG_PRIORITIZE_DISK, FLAG_REQUIRED, FLAG_ALLOW_EMPTY, register\n'), ((1684, 1740), 'sentry.options.register', 'register', (['"""redis.options"""'], {'type': 'Dict', 'flags': 'FLAG_NOSTORE'}), "('redis.options', type=Dict, flags=FLAG_NOSTORE)\n", (1692, 1740), False, 'from sentry.options import FLAG_IMMUTABLE, FLAG_NOSTORE, FLAG_PRIORITIZE_DISK, FLAG_REQUIRED, FLAG_ALLOW_EMPTY, register\n'), ((1765, 1839), 'sentry.options.register', 'register', (['"""dsym.cache-path"""'], {'type': 'String', 'default': '"""/tmp/sentry-dsym-cache"""'}), "('dsym.cache-path', type=String, default='/tmp/sentry-dsym-cache')\n", (1773, 1839), False, 'from sentry.options import FLAG_IMMUTABLE, FLAG_NOSTORE, FLAG_PRIORITIZE_DISK, FLAG_REQUIRED, FLAG_ALLOW_EMPTY, register\n'), ((1848, 1908), 'sentry.options.register', 'register', (['"""mail.backend"""'], {'default': '"""smtp"""', 'flags': 'FLAG_NOSTORE'}), "('mail.backend', default='smtp', flags=FLAG_NOSTORE)\n", (1856, 1908), False, 'from sentry.options import FLAG_IMMUTABLE, FLAG_NOSTORE, FLAG_PRIORITIZE_DISK, FLAG_REQUIRED, FLAG_ALLOW_EMPTY, register\n'), ((1909, 1999), 'sentry.options.register', 'register', (['"""mail.host"""'], {'default': '"""localhost"""', 'flags': '(FLAG_REQUIRED | FLAG_PRIORITIZE_DISK)'}), "('mail.host', default='localhost', flags=FLAG_REQUIRED |\n    FLAG_PRIORITIZE_DISK)\n", (1917, 1999), False, 'from sentry.options import FLAG_IMMUTABLE, FLAG_NOSTORE, FLAG_PRIORITIZE_DISK, FLAG_REQUIRED, FLAG_ALLOW_EMPTY, register\n'), ((1996, 2073), 'sentry.options.register', 'register', (['"""mail.port"""'], {'default': '(25)', 'flags': '(FLAG_REQUIRED | FLAG_PRIORITIZE_DISK)'}), "('mail.port', default=25, flags=FLAG_REQUIRED | FLAG_PRIORITIZE_DISK)\n", (2004, 2073), False, 'from sentry.options import FLAG_IMMUTABLE, FLAG_NOSTORE, FLAG_PRIORITIZE_DISK, FLAG_REQUIRED, FLAG_ALLOW_EMPTY, register\n'), ((2074, 2166), 'sentry.options.register', 'register', (['"""mail.username"""'], {'flags': '(FLAG_REQUIRED | FLAG_ALLOW_EMPTY | FLAG_PRIORITIZE_DISK)'}), "('mail.username', flags=FLAG_REQUIRED | FLAG_ALLOW_EMPTY |\n    FLAG_PRIORITIZE_DISK)\n", (2082, 2166), False, 'from sentry.options import FLAG_IMMUTABLE, FLAG_NOSTORE, FLAG_PRIORITIZE_DISK, FLAG_REQUIRED, FLAG_ALLOW_EMPTY, register\n'), ((2163, 2255), 'sentry.options.register', 'register', (['"""mail.password"""'], {'flags': '(FLAG_REQUIRED | FLAG_ALLOW_EMPTY | FLAG_PRIORITIZE_DISK)'}), "('mail.password', flags=FLAG_REQUIRED | FLAG_ALLOW_EMPTY |\n    FLAG_PRIORITIZE_DISK)\n", (2171, 2255), False, 'from sentry.options import FLAG_IMMUTABLE, FLAG_NOSTORE, FLAG_PRIORITIZE_DISK, FLAG_REQUIRED, FLAG_ALLOW_EMPTY, register\n'), ((2252, 2339), 'sentry.options.register', 'register', (['"""mail.use-tls"""'], {'default': '(False)', 'flags': '(FLAG_REQUIRED | FLAG_PRIORITIZE_DISK)'}), "('mail.use-tls', default=False, flags=FLAG_REQUIRED |\n    FLAG_PRIORITIZE_DISK)\n", (2260, 2339), False, 'from sentry.options import FLAG_IMMUTABLE, FLAG_NOSTORE, FLAG_PRIORITIZE_DISK, FLAG_REQUIRED, FLAG_ALLOW_EMPTY, register\n'), ((2336, 2421), 'sentry.options.register', 'register', (['"""mail.subject-prefix"""'], {'default': '"""[Sentry] """', 'flags': 'FLAG_PRIORITIZE_DISK'}), "('mail.subject-prefix', default='[Sentry] ', flags=FLAG_PRIORITIZE_DISK\n    )\n", (2344, 2421), False, 'from sentry.options import FLAG_IMMUTABLE, FLAG_NOSTORE, FLAG_PRIORITIZE_DISK, FLAG_REQUIRED, FLAG_ALLOW_EMPTY, register\n'), ((2417, 2512), 'sentry.options.register', 'register', (['"""mail.from"""'], {'default': '"""root@localhost"""', 'flags': '(FLAG_REQUIRED | FLAG_PRIORITIZE_DISK)'}), "('mail.from', default='root@localhost', flags=FLAG_REQUIRED |\n    FLAG_PRIORITIZE_DISK)\n", (2425, 2512), False, 'from sentry.options import FLAG_IMMUTABLE, FLAG_NOSTORE, FLAG_PRIORITIZE_DISK, FLAG_REQUIRED, FLAG_ALLOW_EMPTY, register\n'), ((2509, 2599), 'sentry.options.register', 'register', (['"""mail.list-namespace"""'], {'type': 'String', 'default': '"""localhost"""', 'flags': 'FLAG_NOSTORE'}), "('mail.list-namespace', type=String, default='localhost', flags=\n    FLAG_NOSTORE)\n", (2517, 2599), False, 'from sentry.options import FLAG_IMMUTABLE, FLAG_NOSTORE, FLAG_PRIORITIZE_DISK, FLAG_REQUIRED, FLAG_ALLOW_EMPTY, register\n'), ((2595, 2669), 'sentry.options.register', 'register', (['"""mail.enable-replies"""'], {'default': '(False)', 'flags': 'FLAG_PRIORITIZE_DISK'}), "('mail.enable-replies', default=False, flags=FLAG_PRIORITIZE_DISK)\n", (2603, 2669), False, 'from sentry.options import FLAG_IMMUTABLE, FLAG_NOSTORE, FLAG_PRIORITIZE_DISK, FLAG_REQUIRED, FLAG_ALLOW_EMPTY, register\n'), ((2670, 2764), 'sentry.options.register', 'register', (['"""mail.reply-hostname"""'], {'default': '""""""', 'flags': '(FLAG_ALLOW_EMPTY | FLAG_PRIORITIZE_DISK)'}), "('mail.reply-hostname', default='', flags=FLAG_ALLOW_EMPTY |\n    FLAG_PRIORITIZE_DISK)\n", (2678, 2764), False, 'from sentry.options import FLAG_IMMUTABLE, FLAG_NOSTORE, FLAG_PRIORITIZE_DISK, FLAG_REQUIRED, FLAG_ALLOW_EMPTY, register\n'), ((2761, 2856), 'sentry.options.register', 'register', (['"""mail.mailgun-api-key"""'], {'default': '""""""', 'flags': '(FLAG_ALLOW_EMPTY | FLAG_PRIORITIZE_DISK)'}), "('mail.mailgun-api-key', default='', flags=FLAG_ALLOW_EMPTY |\n    FLAG_PRIORITIZE_DISK)\n", (2769, 2856), False, 'from sentry.options import FLAG_IMMUTABLE, FLAG_NOSTORE, FLAG_PRIORITIZE_DISK, FLAG_REQUIRED, FLAG_ALLOW_EMPTY, register\n'), ((2860, 2953), 'sentry.options.register', 'register', (['"""sms.twilio-account"""'], {'default': '""""""', 'flags': '(FLAG_ALLOW_EMPTY | FLAG_PRIORITIZE_DISK)'}), "('sms.twilio-account', default='', flags=FLAG_ALLOW_EMPTY |\n    FLAG_PRIORITIZE_DISK)\n", (2868, 2953), False, 'from sentry.options import FLAG_IMMUTABLE, FLAG_NOSTORE, FLAG_PRIORITIZE_DISK, FLAG_REQUIRED, FLAG_ALLOW_EMPTY, register\n'), ((2950, 3041), 'sentry.options.register', 'register', (['"""sms.twilio-token"""'], {'default': '""""""', 'flags': '(FLAG_ALLOW_EMPTY | FLAG_PRIORITIZE_DISK)'}), "('sms.twilio-token', default='', flags=FLAG_ALLOW_EMPTY |\n    FLAG_PRIORITIZE_DISK)\n", (2958, 3041), False, 'from sentry.options import FLAG_IMMUTABLE, FLAG_NOSTORE, FLAG_PRIORITIZE_DISK, FLAG_REQUIRED, FLAG_ALLOW_EMPTY, register\n'), ((3038, 3130), 'sentry.options.register', 'register', (['"""sms.twilio-number"""'], {'default': '""""""', 'flags': '(FLAG_ALLOW_EMPTY | FLAG_PRIORITIZE_DISK)'}), "('sms.twilio-number', default='', flags=FLAG_ALLOW_EMPTY |\n    FLAG_PRIORITIZE_DISK)\n", (3046, 3130), False, 'from sentry.options import FLAG_IMMUTABLE, FLAG_NOSTORE, FLAG_PRIORITIZE_DISK, FLAG_REQUIRED, FLAG_ALLOW_EMPTY, register\n'), ((3134, 3219), 'sentry.options.register', 'register', (['"""u2f.app-id"""'], {'default': '""""""', 'flags': '(FLAG_ALLOW_EMPTY | FLAG_PRIORITIZE_DISK)'}), "('u2f.app-id', default='', flags=FLAG_ALLOW_EMPTY |\n    FLAG_PRIORITIZE_DISK)\n", (3142, 3219), False, 'from sentry.options import FLAG_IMMUTABLE, FLAG_NOSTORE, FLAG_PRIORITIZE_DISK, FLAG_REQUIRED, FLAG_ALLOW_EMPTY, register\n'), ((3216, 3316), 'sentry.options.register', 'register', (['"""u2f.facets"""'], {'default': '()', 'type': 'Sequence', 'flags': '(FLAG_ALLOW_EMPTY | FLAG_PRIORITIZE_DISK)'}), "('u2f.facets', default=(), type=Sequence, flags=FLAG_ALLOW_EMPTY |\n    FLAG_PRIORITIZE_DISK)\n", (3224, 3316), False, 'from sentry.options import FLAG_IMMUTABLE, FLAG_NOSTORE, FLAG_PRIORITIZE_DISK, FLAG_REQUIRED, FLAG_ALLOW_EMPTY, register\n'), ((3323, 3415), 'sentry.options.register', 'register', (['"""auth.ip-rate-limit"""'], {'default': '(0)', 'flags': '(FLAG_ALLOW_EMPTY | FLAG_PRIORITIZE_DISK)'}), "('auth.ip-rate-limit', default=0, flags=FLAG_ALLOW_EMPTY |\n    FLAG_PRIORITIZE_DISK)\n", (3331, 3415), False, 'from sentry.options import FLAG_IMMUTABLE, FLAG_NOSTORE, FLAG_PRIORITIZE_DISK, FLAG_REQUIRED, FLAG_ALLOW_EMPTY, register\n'), ((3412, 3506), 'sentry.options.register', 'register', (['"""auth.user-rate-limit"""'], {'default': '(0)', 'flags': '(FLAG_ALLOW_EMPTY | FLAG_PRIORITIZE_DISK)'}), "('auth.user-rate-limit', default=0, flags=FLAG_ALLOW_EMPTY |\n    FLAG_PRIORITIZE_DISK)\n", (3420, 3506), False, 'from sentry.options import FLAG_IMMUTABLE, FLAG_NOSTORE, FLAG_PRIORITIZE_DISK, FLAG_REQUIRED, FLAG_ALLOW_EMPTY, register\n'), ((3504, 3603), 'sentry.options.register', 'register', (['"""api.rate-limit.org-create"""'], {'default': '(5)', 'flags': '(FLAG_ALLOW_EMPTY | FLAG_PRIORITIZE_DISK)'}), "('api.rate-limit.org-create', default=5, flags=FLAG_ALLOW_EMPTY |\n    FLAG_PRIORITIZE_DISK)\n", (3512, 3603), False, 'from sentry.options import FLAG_IMMUTABLE, FLAG_NOSTORE, FLAG_PRIORITIZE_DISK, FLAG_REQUIRED, FLAG_ALLOW_EMPTY, register\n'), ((3613, 3684), 'sentry.options.register', 'register', (['"""filestore.backend"""'], {'default': '"""filesystem"""', 'flags': 'FLAG_NOSTORE'}), "('filestore.backend', default='filesystem', flags=FLAG_NOSTORE)\n", (3621, 3684), False, 'from sentry.options import FLAG_IMMUTABLE, FLAG_NOSTORE, FLAG_PRIORITIZE_DISK, FLAG_REQUIRED, FLAG_ALLOW_EMPTY, register\n'), ((3685, 3781), 'sentry.options.register', 'register', (['"""filestore.options"""'], {'default': "{'location': '/tmp/sentry-files'}", 'flags': 'FLAG_NOSTORE'}), "('filestore.options', default={'location': '/tmp/sentry-files'},\n    flags=FLAG_NOSTORE)\n", (3693, 3781), False, 'from sentry.options import FLAG_IMMUTABLE, FLAG_NOSTORE, FLAG_PRIORITIZE_DISK, FLAG_REQUIRED, FLAG_ALLOW_EMPTY, register\n')]