foldsite/docs/content/Configuration.md
Tanishq Dubey 2adde253c9
All checks were successful
Release / build (push) Successful in 34s
Release / publish_head (push) Successful in 33s
Datadog Software Composition Analysis / Datadog SBOM Generation and Upload (push) Successful in 15s
Datadog Secrets Scanning / Datadog Static Analyzer (push) Successful in 10s
Datadog Static Analysis / Datadog Static Analyzer (push) Successful in 20s
Release / publish_head (release) Has been skipped
Release / build (release) Successful in 37s
start updating docs, other changes to file upload
2025-03-16 21:22:28 -04:00

1.8 KiB

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:

[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).