from datetime import timedelta

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

### Unhappy mako
MAKO_OUTPUT_ENCODING='utf-8'

{% if environment == "staging" %}
DATAGREPPER_BASE_URL='https://apps.stg.fedoraproject.org/datagrepper/'
{% else %}
DATAGREPPER_BASE_URL='https://apps.fedoraproject.org/datagrepper/'
{% endif %}

DATAGREPPER_CACHE_BACKEND='dogpile.cache.memcached'
{% if environment == "staging" %}
DATAGREPPER_CACHE_KWARGS={'arguments': {'url': 'app01.stg.phx2.fedoraproject.org:11211'}}
{% else %}
DATAGREPPER_CACHE_KWARGS={'arguments': {'url': ['memcached01.phx2.fedoraproject.org:11211', 'memcached02.phx2.fedoraproject.org:11211']}}
{% endif %}

{% if environment == "staging" %}
SQLALCHEMY_DATABASE_URI='postgresql+psycopg2://{{ datagrepper_app_user }}:{{ datagrepper_app_password }}@db02.stg.phx2.fedoraproject.org:5432/datagrepper'
{% else %}
SQLALCHEMY_DATABASE_URI='postgresql+psycopg2://{{ datagrepper_app_user }}:{{ datagrepper_app_password }}@db01.phx2.fedoraproject.org:5432/datagrepper'
{% endif %}

{% if environment == "staging" %}
DATAGREPPER_OPENID_ENDPOINT='id.stg.fedoraproject.org'
{% else %}
DATAGREPPER_OPENID_ENDPOINT='id.fedoraproject.org'
{% endif %}

RUNNER_LOCKFILE='/var/run/fedmsg/datagrepper.lock'
JOB_OUTPUT_DIR='/var/cache/datagrepper'
JOB_OUTPUT_URL='https://apps.{% if environment == "staging" %}stg.{% endif %}fedoraproject.org/datagrepper/output'
JOB_EXPIRY=timedelta(days=7)
