# -*- coding: utf-8 -*-

"""
Pootle configuration for Travis
https://travis-ci.org
"""

import os


if os.environ.get("TRAVIS"):
    DEBUG = True

    SECRET_KEY = '__Travis1234567890__'

    DATABASE_BACKEND = os.environ.get("DATABASE_BACKEND")
    DATABASES = {
        'default': {
            'ENGINE': 'transaction_hooks.backends.sqlite3',
            'NAME': working_path('dbs/pootle_travis.db'),
            'USER': '',
            'PASSWORD': '',
            'HOST': '',
            'PORT': '',
            'ATOMIC_REQUESTS': True,
        }
    }

    if DATABASE_BACKEND == "postgres":
        DATABASES['default']['ENGINE'] = \
            'transaction_hooks.backends.postgresql_psycopg2'
        DATABASES['default']['NAME'] = 'pootle'
        DATABASES['default']['USER'] = 'postgres'
    elif DATABASE_BACKEND.startswith("mysql"):
        DATABASES['default']['ENGINE'] = 'transaction_hooks.backends.mysql'
        DATABASES['default']['NAME'] = 'pootle'
        DATABASES['default']['USER'] = 'travis'

    SILENCED_SYSTEM_CHECKS = [
        'pootle.W004',  # Pootle requires a working mail server
        'pootle.W005',  # DEBUG = True
        'pootle.W010',  # DEFAULT_FROM_EMAIL has default setting
        'pootle.W011',  # POOTLE_CONTACT_EMAIL has default setting
    ]
