# Cosmian KMS Environment Configuration
# Generated by provisioning system

KMS_VERSION={{ kms.version }}
KMS_RUN_USER={{ kms.run_user.name }}
KMS_RUN_GROUP={{ kms.run_user.group }}
KMS_RUN_USER_HOME={{ kms.run_user.home }}
KMS_WORK_PATH={{ kms.work_path }}
KMS_CONFIG_PATH={{ kms.config_path }}
KMS_CONFIG_FILE={{ kms.config_file }}
KMS_RUN_PATH={{ kms.run_path }}

# Server Configuration
KMS_BIND_ADDR={{ kms.bind_addr }}
KMS_PORT={{ kms.port }}
KMS_LOG_LEVEL={{ kms.log_level }}
KMS_FIPS_MODE={{ kms.fips_mode | lower }}

# Database Configuration
KMS_DATABASE_TYPE={{ kms.database.typ }}
{% if kms.database.typ != "sqlite" %}
KMS_DATABASE_HOST={{ kms.database.host }}
KMS_DATABASE_PORT={{ kms.database.port }}
KMS_DATABASE_NAME={{ kms.database.database }}
KMS_DATABASE_USERNAME={{ kms.database.username }}
KMS_DATABASE_PASSWORD={{ kms.database.password }}
KMS_DATABASE_SSL_MODE={{ kms.database.ssl_mode }}
{% else %}
KMS_DATABASE_PATH={{ kms.database.path }}
{% endif %}

# TLS Configuration
KMS_TLS_ENABLED={{ kms.tls_enabled | lower }}
{% if kms.tls_enabled %}
KMS_CERT_FILE={{ kms.cert_file }}
KMS_KEY_FILE={{ kms.key_file }}
{% if kms.ca_cert_file is defined %}
KMS_CA_CERT_FILE={{ kms.ca_cert_file }}
{% endif %}
{% endif %}

# Authentication Configuration
KMS_AUTH_ENABLED={{ kms.auth.enabled | lower }}
{% if kms.auth.enabled %}
KMS_JWT_ISSUER_URI={{ kms.auth.jwt_issuer_uri }}
{% if kms.auth.jwks_uri is defined %}
KMS_JWKS_URI={{ kms.auth.jwks_uri }}
{% endif %}
{% if kms.auth.jwt_audience is defined %}
KMS_JWT_AUDIENCE={{ kms.auth.jwt_audience }}
{% endif %}
{% endif %}

# Configuration file path for runtime
COSMIAN_KMS_CONF={{ kms.config_path }}/{{ kms.config_file }}