# Redis environment template for provisioning system
# This file generates environment variables for Redis configuration

# Basic configuration
export REDIS_VERSION="{{ version }}"
export REDIS_PORT="{{ port }}"
export REDIS_BIND_ADDRESS="{{ bind_address }}"

# Memory configuration
export REDIS_MAXMEMORY="{{ maxmemory }}"
export REDIS_MAXMEMORY_POLICY="{{ maxmemory_policy }}"

# Persistence
export REDIS_PERSISTENCE="{{ persistence | lower }}"
export REDIS_SAVE_INTERVAL="{{ save_interval }}"

# Security
{% if requirepass is defined %}
export REDIS_PASSWORD="{{ requirepass }}"
{% endif %}

# Replication
{% if master_host is defined %}
export REDIS_MASTER_HOST="{{ master_host }}"
export REDIS_MASTER_PORT="{{ master_port | default(6379) }}"
{% endif %}

# Clustering
export REDIS_CLUSTER_ENABLED="{{ cluster_enabled | lower }}"
{% if cluster_config_file is defined %}
export REDIS_CLUSTER_CONFIG_FILE="{{ cluster_config_file }}"
{% endif %}

# Logging
export REDIS_LOGLEVEL="{{ loglevel }}"
export REDIS_LOGFILE="{{ logfile }}"

# Performance
export REDIS_TCP_KEEPALIVE="{{ tcp_keepalive }}"
export REDIS_TIMEOUT="{{ timeout }}"

# Service information
export TASKSERV_NAME="{{ name }}"
export TASKSERV_TYPE="redis"