apiVersion: v1
kind: Secret
metadata:
  name: "resultsdb-config"
  labels:
    app: resultsdb
stringData:
  settings.py: |-
{% if env == 'staging' %}
    SECRET_KEY = '{{ stg_resultsdb_secret_key }}'
{% else %}
    SECRET_KEY = '{{ prod_resultsdb_secret_key }}'
{% endif %}
{% if env == 'staging' %}
    SQLALCHEMY_DATABASE_URI='postgresql+psycopg2://{{ stg_resultsdb_db_user }}:{{ stg_resultsdb_db_password }}@{{ stg_resultsdb_db_host }}:{{ stg_resultsdb_db_port }}/{{ stg_resultsdb_db_name }}'
{% else %}
    SQLALCHEMY_DATABASE_URI='postgresql+psycopg2://{{ prod_resultsdb_db_user }}:{{ prod_resultsdb_db_password }}@{{ prod_resultsdb_db_host }}:{{ prod_resultsdb_db_port }}/{{ prod_resultsdb_db_name }}'
{% endif %}
    LOGGING = {
        'version': 1,
        'disable_existing_loggers': False,
        'loggers': {
            'resultsdb': {
                'level': 'DEBUG',
            },
        },
        'handlers': {
            'console': {
                'formatter': 'bare',
                'class': 'logging.StreamHandler',
                'stream': 'ext://sys.stdout',
                'level': 'INFO',
            },
        },
        'formatters': {
            'bare': {
                'format': '[%(asctime)s] [%(process)d] [%(levelname)s] %(name)s: %(message)s',
                'datefmt': '%Y-%m-%d %H:%M:%S',
            }
        },
        'root': {
            'level': 'WARNING',
            'handlers': ['console'],
        },
    }
    RUN_HOST= '0.0.0.0'
    RUN_PORT = 5001
{% if deployment_type is defined and deployment_type in ['local', 'dev']%}
    MESSAGE_BUS_PUBLISH = False
    MESSAGE_BUS_PUBLISH_TASKOTRON = False
{% else %}
    MESSAGE_BUS_PUBLISH = True
    MESSAGE_BUS_PUBLISH_TASKOTRON = True
{% endif %}
    MESSAGE_BUS_PLUGIN = 'fedmsg'
{% if deployment_type is defined and deployment_type in ['local'] %}
    # This is for the Testdays deployment
    MESSAGE_BUS_PLUGIN = 'dummy'
{% endif %}
    MESSAGE_BUS_KWARGS = {'modname': 'resultsdb'}
    ADDITIONAL_RESULT_OUTCOMES = {{ resultsdb_additional_result_outcomes }}
  .htpasswd: |-
{% if env == 'staging' %}
    {{ stg_resultsdb_httpd_user }}:{{ stg_resultsdb_httpd_password_encoded }}
{% else %}
    {{ prod_resultsdb_httpd_user }}:{{ prod_resultsdb_httpd_password_encoded }}
{% endif %}
