# Generated Nickel configuration from form results
# This template renders form data into a valid Nickel configuration

{
  # Application Configuration
  app = {
    name | doc "Application name" : String = "{{ app_name }}",
    {%- if app_version is defined %}
    version | doc "Version" : String = "{{ app_version }}",
    {%- else %}
    version : String = "1.0.0",
    {%- endif %}
  },

  # Server Configuration
  server = {
    host | doc "Server host" : String = "{{ server_host | default('0.0.0.0') }}",
    port | doc "Server port" : Number = {{ server_port | default(8080) }},
    {%- if timeout is defined %}
    timeout | doc "Request timeout" : Number = {{ timeout }},
    {%- endif %}
  },

  {%- if database_url is defined %}
  # Database Configuration
  database = {
    url | doc "Database URL" : String = "{{ database_url }}",
    {%- if database_pool_size is defined %}
    pool_size | doc "Connection pool size" : Number = {{ database_pool_size }},
    {%- endif %}
  },
  {%- endif %}

  {%- if enable_caching == "true" or enable_caching == true %}
  # Cache Configuration
  cache = {
    enabled | doc "Caching enabled" : Bool = true,
    {%- if cache_ttl is defined %}
    ttl | doc "Cache TTL" : Number = {{ cache_ttl }},
    {%- endif %}
  },
  {%- endif %}
}
