"use strict";

function loadConfiguration() {
  return {
    module: "middleware",
    title: "Middleware",
    enabled: true,
    version: "{{ rapidkit_vendor_version }}",
    defaults: {
      cors_enabled: {{ middleware_defaults.get('cors_enabled', False) | tojson }},
      cors_allow_origins: {{ middleware_defaults.get('cors_allow_origins', ['*']) | tojson(indent=2) }},
      cors_allow_methods: {{ middleware_defaults.get('cors_allow_methods', ['*']) | tojson(indent=2) }},
      cors_allow_headers: {{ middleware_defaults.get('cors_allow_headers', ['*']) | tojson(indent=2) }},
      cors_allow_credentials: {{ middleware_defaults.get('cors_allow_credentials', True) | tojson }},
      process_time_header: {{ middleware_defaults.get('process_time_header', True) | tojson }},
      service_header: {{ middleware_defaults.get('service_header', True) | tojson }},
      service_header_name: {{ middleware_defaults.get('service_header_name', 'X-Service') | tojson }},
      service_name: {{ middleware_defaults.get('service_name') | tojson }},
      custom_headers: {{ middleware_defaults.get('custom_headers', True) | tojson }},
      custom_header_name: {{ middleware_defaults.get('custom_header_name', 'X-Custom-Header') | tojson }},
      custom_header_value: {{ middleware_defaults.get('custom_header_value', 'RapidKit') | tojson }},
      metadata: {{ middleware_defaults.get('metadata', {}) | tojson(indent=2) }},
    },
  };
}

module.exports = {
  loadConfiguration,
};
