#!/usr/bin/env bash

#
# Template for eIDAS Connector configuration
# Script within docker container reads from /etc/eidas-connector/env/ - So make sure to have a volume mount.
#

#
# Logging settings
#

# Logback log levels
#   There must be a Docker volume mounted to the /etc/eidas-connector directory.
export IDP_LOG_SETTINGS_FILE=/etc/eidas-connector/loglevels.xml

# Process logs go to stdout
export IDP_LOG_CONSOLE=false

# Syslog (for Audit and F-TICKS)
export IDP_SYSLOG_HOST=log.qa.sveidas.se
export IDP_SYSLOG_PORT=514

export IDP_PROCESS_SYSLOG_HOST=log.qa.sveidas.se
export IDP_PROCESS_SYSLOG_PORT=514

export IDP_STATS_SYSLOG_HOST=log.qa.sveidas.se
export IDP_STATS_SYSLOG_PORT=514
export IDP_STATS_SYSLOG_FACILITY=LOCAL4

export IDP_AUDIT_SYSLOG_FACILITY=LOCAL0

export IDP_FTICKS_FEDERATION_ID=eIDAS
export IDP_FTICKS_SYSLOG_FACILITY=LOCAL1
export IDP_PROCESS_SYSLOG_FACILITY=LOCAL2


# JVM settings
export JVM_MAX_HEAP=1536m
export JVM_START_HEA=512m

export IDP_TLS_TRUSTED_CERTS=/etc/ssl/certs/infra.crt

export IDP_CREDENTIALS=/etc/eidas-connector/credentials
export IDP_SEALER_STORE_RESOURCE=$IDP_CREDENTIALS/sealer.jks
export IDP_SEALER_VERSION_RESOURCES=$IDP_CREDENTIALS/sealer.kver

export IDP_SIGNING_KEY=$IDP_CREDENTIALS/connector.key
export IDP_SIGNING_CERT=$IDP_CREDENTIALS/connector.crt
export IDP_ENCRYPTION_KEY=$IDP_CREDENTIALS/connector.key
export IDP_ENCRYPTION_CERT=$IDP_CREDENTIALS/connector.crt
export IDP_METADATA_SIGNING_KEY=$IDP_CREDENTIALS/metadata.key
export IDP_METADATA_SIGNING_CERT=$IDP_CREDENTIALS/metadata.crt

export SP_CREDENTIALS=/etc/eidas-connector/credentials
export SP_SIGNING_KEY=$SP_CREDENTIALS/connector.key
export SP_SIGNING_CERT=$SP_CREDENTIALS/connector.crt
export SP_ENCRYPTION_KEY=$SP_CREDENTIALS/connector.key
export SP_ENCRYPTION_CERT=$SP_CREDENTIALS/connector.crt
export SP_METADATA_SIGNING_KEY=$SP_CREDENTIALS/metadata.key
export SP_METADATA_SIGNING_CERT=$SP_CREDENTIALS/metadata.crt

# Tomcat settings
export TOMCAT_CREDENTIALS=/etc/eidas-connector/credentials/tomcat
export TOMCAT_TLS_SERVER_KEY=$TOMCAT_CREDENTIALS/tomcat-key.pem
export TOMCAT_TLS_SERVER_CERTIFICATE=$TOMCAT_CREDENTIALS/tomcat-cert.pem
export TOMCAT_TLS_SERVER_CERTIFICATE_CHAIN=$TOMCAT_CREDENTIALS/tomcat-chain.pem
export TOMCAT_INTERNAL_PROXIES='"10\.\d{1,3}\.\d{1,3}\.\d{1,3}\|192\.168\.\d{1,3}\.\d{1,3}\|169\.254\.\d{1,3}\.\d{1,3}\|127\.\d{1,3}\.\d{1,3}\.\d{1,3}\|172\.1[6-9]{1}\.\d{1,3}\.\d{1,3}\|172\.2[0-9]{1}\.\d{1,3}\.\d{1,3}\|172\.3[0-1]{1}\.\d{1,3}\.\d{1,3}\|130\.242\.125\.\d{1,3}\|81\.236\.48\.\d{1,3}"'
export TOMCAT_SESSION_COOKIE_NAME="JSESSIONID.CONNECTOR.QA"

export FEDERATION_METADATA_URL=https://qa.md.swedenconnect.se/entities
export FEDERATION_METADATA_VALIDATION_CERT=/etc/eidas-connector/credentials/metadata.crt

#export EIDAS_METADATA_SERVICE_LIST_URL=https://qa.md.eidas.swedenconnect.se/mdservicelist-aggregate.xml
unset EIDAS_METADATA_SERVICE_LIST_URL
#export EIDAS_METADATA_SERVICE_LIST_VALIDATION_CERT=/etc/eidas-connector/credentials/metadata.crt
unset EIDAS_METADATA_SERVICE_LIST_VALIDATION_CERT

export EIDAS_METADATA_URL=https://qa.md.eidas.swedenconnect.se/entities
export EIDAS_METADATA_VALIDATION_CERT=/etc/eidas-connector/credentials/metadata.crt
