# Beware that the quotes around the values are mandatory

import os

### Secret key for the Flask application
SECRET_KEY='{{ elections_secret_key }}'

# Used by SESSION_COOKIE_PATH
APPLICATION_ROOT = '/'

### url to the database server:
{% if env == 'staging' %}
DB_URL='postgresql://{{ elections_db_user }}:{{ elections_stg_db_pass }}@db01{{ env_suffix }}.{{ datacenter }}.fedoraproject.org/{{ elections_db_name }}'
{% else %}
DB_URL='postgresql://{{ elections_db_user }}:{{ elections_db_pass }}@db01{{ env_suffix }}.{{ datacenter }}.fedoraproject.org/{{ elections_db_name }}'
{% endif %}

## One ore more FAS group that will have admin rights over the whole
## application, including all elections past, present and future
FEDORA_ELECTIONS_ADMIN_GROUP = 'elections'


OIDC_CLIENT_SECRETS = '/opt/app-root/secret/client_secrets.json'

## Fedora-elections can integrate with FAS to retrieve information about the
## candidates, the following configuration keys are required for this
## integration.
## URL of the FAS server to use
{% if env == 'staging' %}
FASJSON = True
FAS_BASE_URL = 'https://fasjson.stg.fedoraproject.org/'
{% else %}
FASJSON = True
FAS_BASE_URL = 'https://fasjson.fedoraproject.org/'
FAS_USERNAME = '{{ fedorathirdpartyUser }}'
FAS_PASSWORD = '{{ fedorathirdpartyPassword }}'
## This should be ``True`` but should be changed to ``False`` if the FAS server
## used does not have a valid SSL certificate.
FAS_CHECK_CERT = True
{% endif %}

# This is required to fix login
PREFERRED_URL_SCHEME='https'

# Make browsers send session cookie only via HTTPS
SESSION_COOKIE_SECURE = True
SESSION_COOKIE_NAME = 'elections'


DOGPILE_CACHE = {
    'backend': 'dogpile.cache.memcached',
    'arguments': {
        'url': ["memcached01:11211"],
        'distributed_lock': True,
    },
}

## URLs to fedmenu resources
{% if env == 'staging' %}
FEDMENU_URL = 'https://apps.stg.fedoraproject.org/fedmenu'
FEDMENU_DATA_URL = 'https://apps.stg.fedoraproject.org/js/data.js'
{% else %}
FEDMENU_URL = 'https://apps.fedoraproject.org/fedmenu'
FEDMENU_DATA_URL = 'https://apps.fedoraproject.org/js/data.js'
{% endif %}
