# coding: utf-8
# Re2o est un logiciel d'administration développé initiallement au rezometz. Il
# se veut agnostique au réseau considéré, de manière à être installable en
# quelques clics.
#
# Copyright © 2017  Gabriel Détraz
# Copyright © 2017  Goulven Kermarec
# Copyright © 2017  Augustin Lemesle
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
"""re2o.settings_locale
The file with all the available options for a locale configuration of re2o
"""

from __future__ import unicode_literals

# A secret key used by the server.
SECRET_KEY = "{{ re2o_secret_key }}"

# The password to access the project database
DB_PASSWORD = "{{ re2o_db_password }}"

# AES key for secret key encryption.
# The length must be a multiple of 16
AES_KEY = "{{ re2o_aes_key }}"

# Should the server run in debug mode ?
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False

# A list of admins of the services. Receive mails when an error occurs
ADMINS = [('AURORE', 'monitoring.aurore@lists.crans.org'),]

# The list of hostname the server will respond to.
ALLOWED_HOSTS = ['{{ inventory_hostname }}']

# The time zone the server is runned in
TIME_ZONE = 'Europe/Paris'

# The storage systems parameters to use
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': 're2o',
        'USER': 're2o',
        'PASSWORD': DB_PASSWORD,
        'HOST': 're2o-db.adm.auro.re',
        'TEST': {
            'CHARSET': 'utf8',
            'COLLATION': 'utf8_general_ci'
        }
    },
    'local': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': 're2o',
        'USER': 're2o_ro',
        'PASSWORD': "{{ radius_pg_re2o_ro_password }}",
        'HOST': 'localhost',
        'TEST': {
            'CHARSET': 'utf8',
            'COLLATION': 'utf8_general_ci'
        }
    },
    'ldap': {
        'ENGINE': 'ldapdb.backends.ldap',
        'NAME': 'ldap://10.128.0.21/',
        'USER': 'cn=admin,dc=auro,dc=re',
        'TLS': False,
        'PASSWORD': '{{ ldap_admin_password }}',
    }
}

# Security settings for secure https
# Activate once https is correctly configured
SECURE_CONTENT_TYPE_NOSNIFF = False
SECURE_BROWSER_XSS_FILTER = False
SESSION_COOKIE_SECURE = False
CSRF_COOKIE_SECURE = False
CSRF_COOKIE_HTTPONLY = False
X_FRAME_OPTIONS = 'DENY'
SESSION_COOKIE_AGE = 60 * 60 * 3

# The path where your organization logo is stored
LOGO_PATH = "static_files/logo.png"

# The mail configuration for Re2o to send mails
SERVER_EMAIL = 'no-reply@auro.re'  # The mail address to use
EMAIL_HOST = 'localhost'           # The host to use
EMAIL_PORT = 25             # The port to use

# Settings of the LDAP structure
LDAP = {
    'base_user_dn': 'cn=Utilisateurs,dc=auro,dc=re',
    'base_userservice_dn': 'ou=service-users,dc=auro,dc=re',
    'base_usergroup_dn': 'ou=posix,ou=groups,dc=auro,dc=re',
    'base_userservicegroup_dn': 'ou=services,ou=groups,dc=auro,dc=re',
    'user_gid': 100,
    }

# A range of UID to use. Used in linux environement
UID_RANGES = {
    'users': [21001, 30000],
    'service-users': [20000, 21000],
}

# A range of GID to use. Used in linux environement
GID_RANGES = {
    'posix': [501, 600],
}

# Some optionnal Re2o Apps
OPTIONNAL_APPS_RE2O = ()

# Some Django apps you want to add in you local project
OPTIONNAL_APPS = OPTIONNAL_APPS_RE2O + ()

LOCAL_ROUTERS = ["re2o.local_routers.DbRouter"]