# Configuration

## Configuration file

Foldsite is configured using a TOML file (default: `config.toml`). This file specifies paths to content, templates, and styles, as well as server settings.

Example `config.toml`:

```toml
[paths]
content_dir = "/home/myuser/site/content"
templates_dir = "/home/myuser/site/themes/cobalt/templates"
styles_dir = "/home/myuser/site/themes/cobalt/styles"

[server]
listen_address = "127.0.0.1"
listen_port = 8080
debug = false
access_log = true
max_threads = 4
admin_browser = false
admin_password = "your_admin_password"
```

## Server Settings

 - **`listen_address`**: The IP address the server listens on (default: `127.0.0.1`).
 - **`listen_port`**: The port the server listens on (default: `8080`).
 - **`debug`**: Enables or disables debug mode (default: `false`).  In debug mode, the server will automatically reload when code changes are detected, and more detailed error messages will be shown.
 - **`access_log`**: Enables or disables access logging (default: `true`).  If enabled, access logs will be written to standard output.
 - **`max_threads`**:  The maximum number of threads to use for handling requests (default: `4`). This setting directly impacts the concurrency of the server.
 - **`admin_browser`**: Enables or disables the built-in file manager (default: `false`).
 - **`admin_password`**: Sets the password for the file manager.  Required if `admin_browser` is `true`.

The `Configuration` class (`/foldsite/src/config/config.py`) is responsible for loading and parsing this configuration file. It also sets global variables (`CONTENT_DIR`, `TEMPLATES_DIR`, `STYLES_DIR`) for easy access to these directories throughout the application. Errors are raised if the config file is missing, invalid, or lacks required sections (like `paths` or `server`).