# Polkadot Validator Environment Configuration
# Generated by provisioning system

POLKADOT_VERSION={{ polkadot_validator.version }}
POLKADOT_RUN_USER={{ polkadot_validator.run_user.name }}
POLKADOT_RUN_GROUP={{ polkadot_validator.run_user.group }}
POLKADOT_RUN_USER_HOME={{ polkadot_validator.run_user.home }}
POLKADOT_WORK_PATH={{ polkadot_validator.work_path }}
POLKADOT_CONFIG_PATH={{ polkadot_validator.config_path }}
POLKADOT_BIN_PATH={{ polkadot_validator.bin_path }}
POLKADOT_BASE_PATH={{ polkadot_validator.base_path }}
POLKADOT_KEYSTORE_PATH={{ polkadot_validator.keystore_path }}

# Validator Configuration
POLKADOT_VALIDATOR_NAME={{ polkadot_validator.name }}

# Validator Account Configuration
{% if polkadot_validator.validator_accounts.stash_address is defined %}
POLKADOT_STASH_ADDRESS={{ polkadot_validator.validator_accounts.stash_address }}
{% endif %}
{% if polkadot_validator.validator_accounts.controller_address is defined %}
POLKADOT_CONTROLLER_ADDRESS={{ polkadot_validator.validator_accounts.controller_address }}
{% endif %}
POLKADOT_REWARD_DESTINATION={{ polkadot_validator.validator_accounts.reward_destination }}
POLKADOT_COMMISSION={{ polkadot_validator.validator_accounts.commission }}

# Session Keys Configuration
{% if polkadot_validator.session_keys.keys_file is defined %}
POLKADOT_SESSION_KEYS_FILE={{ polkadot_validator.session_keys.keys_file }}
{% endif %}
POLKADOT_SESSION_AUTO_ROTATE={{ polkadot_validator.session_keys.auto_rotate | lower }}
{% if polkadot_validator.session_keys.rotation_interval is defined %}
POLKADOT_SESSION_ROTATION_INTERVAL={{ polkadot_validator.session_keys.rotation_interval }}
{% endif %}

# Network Configuration
POLKADOT_CHAIN={{ polkadot_validator.network.chain }}
POLKADOT_LISTEN_ADDR="{{ polkadot_validator.network.listen_addr }}"
{% if polkadot_validator.network.public_addr is defined %}
POLKADOT_PUBLIC_ADDR="{{ polkadot_validator.network.public_addr }}"
{% endif %}
{% if polkadot_validator.network.node_key_file is defined %}
POLKADOT_NODE_KEY_FILE={{ polkadot_validator.network.node_key_file }}
{% endif %}
POLKADOT_MAX_PEERS={{ polkadot_validator.network.max_peers }}
POLKADOT_MAX_PEERS_LIGHT={{ polkadot_validator.network.max_peers_light }}
POLKADOT_RESERVED_ONLY={{ polkadot_validator.network.reserved_only | lower }}

# Bootnodes and Reserved Nodes
{% if polkadot_validator.network.bootnodes %}
POLKADOT_BOOTNODES="{{ polkadot_validator.network.bootnodes | join(',') }}"
{% endif %}
{% if polkadot_validator.network.reserved_nodes %}
POLKADOT_RESERVED_NODES="{{ polkadot_validator.network.reserved_nodes | join(',') }}"
{% endif %}

# RPC Configuration (Restricted for Validator)
POLKADOT_RPC_ENABLED={{ polkadot_validator.rpc.enabled | lower }}
POLKADOT_RPC_BIND_ADDR={{ polkadot_validator.rpc.bind_addr }}
POLKADOT_RPC_PORT={{ polkadot_validator.rpc.port }}
POLKADOT_WS_PORT={{ polkadot_validator.rpc.ws_port }}
POLKADOT_HTTP_PORT={{ polkadot_validator.rpc.http_port }}
POLKADOT_RPC_MAX_CONNECTIONS={{ polkadot_validator.rpc.max_connections }}
POLKADOT_RPC_CORS="{{ polkadot_validator.rpc.cors | join(',') }}"
POLKADOT_RPC_METHODS="{{ polkadot_validator.rpc.methods | join(',') }}"

# Monitoring Configuration
POLKADOT_MONITORING_ENABLED={{ polkadot_validator.monitoring.enabled | lower }}
POLKADOT_PROMETHEUS_PORT={{ polkadot_validator.monitoring.prometheus_port }}
POLKADOT_PROMETHEUS_BIND_ADDR={{ polkadot_validator.monitoring.prometheus_bind_addr }}
POLKADOT_TELEMETRY_ENABLED={{ polkadot_validator.monitoring.telemetry_enabled | lower }}
POLKADOT_TELEMETRY_URL="{{ polkadot_validator.monitoring.telemetry_url }}"
POLKADOT_TELEMETRY_VERBOSITY={{ polkadot_validator.monitoring.telemetry_verbosity }}

# Security Configuration
POLKADOT_ENABLE_FIREWALL={{ polkadot_validator.security.enable_firewall | lower }}
{% if polkadot_validator.security.allowed_ssh_ips %}
POLKADOT_ALLOWED_SSH_IPS="{{ polkadot_validator.security.allowed_ssh_ips | join(',') }}"
{% endif %}
POLKADOT_FAIL2BAN_ENABLED={{ polkadot_validator.security.fail2ban_enabled | lower }}
POLKADOT_AUTO_UPDATES={{ polkadot_validator.security.auto_updates | lower }}
POLKADOT_SECURE_KEYSTORE={{ polkadot_validator.security.secure_keystore | lower }}
POLKADOT_BACKUP_KEYS={{ polkadot_validator.security.backup_keys | lower }}
{% if polkadot_validator.security.backup_path is defined %}
POLKADOT_BACKUP_PATH={{ polkadot_validator.security.backup_path }}
{% endif %}

# Execution and Performance
POLKADOT_EXECUTION={{ polkadot_validator.execution }}
POLKADOT_WASM_EXECUTION={{ polkadot_validator.wasm_execution }}
POLKADOT_STATE_CACHE_SIZE={{ polkadot_validator.state_cache_size }}
POLKADOT_DB_CACHE={{ polkadot_validator.db_cache }}
POLKADOT_PRUNING={{ polkadot_validator.pruning }}
POLKADOT_UNSAFE_PRUNING={{ polkadot_validator.unsafe_pruning | lower }}

# Logging Configuration
POLKADOT_LOG_LEVEL={{ polkadot_validator.log_level }}
{% if polkadot_validator.log_targets %}
POLKADOT_LOG_TARGETS="{{ polkadot_validator.log_targets | join(',') }}"
{% endif %}