# Configuration Files

## **Why Configuration Files Matter**

While environment variables excel for simple key-value pairs, **configuration files** become essential for complex scenarios:

* **Hierarchical configurations**: Manage multi-level settings (e.g., server blocks in Nginx, database connection pools).
* **Format-sensitive data**: Leverage structured formats like YAML, JSON, or XML for readability and validation.
* **Large-scale configurations**: Handle bulky setups (e.g., routing rules, TLS certificates) more efficiently than environment variables.

### **Key Advantages**

1. **Structured Storage**
   * Organize configurations in standardized formats (YAML/JSON/XML) for services, runtime parameters, and dependencies.
2. **Dynamic Injection**
   * Automatically inject configurations into specified container paths (e.g., `/etc/nginx/nginx.conf`) at startup, decoupling configs from container images.
3. **Hot Reload Support**
   * Enable runtime updates without app restarts for supported applications (e.g., Nginx reload via `nginx -s reload`).

***

## **Step-by-Step: Configuring Nginx**

<figure><img src="/files/YyIENOG6LxgFasmEP2bS" alt=""><figcaption></figcaption></figure>

#### 1. **Locate the Configuration Path**

* Check your Nginx image’s documentation (default path is typically `/etc/nginx/nginx.conf`).
* Enter the **full container path** in the ClawCloud Run control panel.

#### 2. **Edit Configuration Content**

* **Local Preparation**: Draft the configuration locally using an editor like VS Code with syntax validation plugins.

  ```
  user  nginx;
  worker_processes auto;

  error_log  /var/log/nginx/error.log warn;
  pid        /var/run/nginx.pid;


  events {
      worker_connections  1024;
  }

  http {
      include       /etc/nginx/mime.types;
      default_type  application/octet-stream;

      log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                        '$status $body_bytes_sent "$http_referer" '
                        '"$http_user_agent" "$http_x_forwarded_for"';

      log_format upstreamlog '[$time_local] $remote_addr passed to: $upstream_addr: $request Upstream Response Time: $upstream_response_time Request time: $request_time';

      access_log  /var/log/nginx/access.log  main;

      sendfile        on;
      #tcp_nopush     on;

      keepalive_timeout  65;

      #gzip  on;

      include /etc/nginx/conf.d/*.conf;
  }
  ```
* **Copy-Paste**: After testing, paste the validated content into ClawCloud Run’s configuration editor.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.run.claw.cloud/clawcloud-run/guide/app-launchpad/configuration-files.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
