180 lines
6.9 KiB
HTML
180 lines
6.9 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Configuration - pyserve</title>
|
|
<link rel="stylesheet" href="../style.css">
|
|
</head>
|
|
<body>
|
|
<div id="container">
|
|
<div id="header">
|
|
<h1>pyserve</h1>
|
|
<div class="tagline">python application orchestrator</div>
|
|
</div>
|
|
|
|
<div class="breadcrumb">
|
|
<a href="../index.html">pyserve</a> » <a href="/guides/">Guides</a> » Configuration
|
|
</div>
|
|
|
|
<div id="content">
|
|
<h2>Configuration Reference</h2>
|
|
|
|
<p>pyserve uses YAML configuration files. By default, it looks for
|
|
<code>config.yaml</code> in the current directory.</p>
|
|
|
|
<h3>http</h3>
|
|
<p>HTTP-related paths configuration.</p>
|
|
<dl>
|
|
<dt>static_dir</dt>
|
|
<dd>Path to static files directory. Default: <code>./static</code></dd>
|
|
|
|
<dt>templates_dir</dt>
|
|
<dd>Path to templates directory. Default: <code>./templates</code></dd>
|
|
</dl>
|
|
|
|
<h3>server</h3>
|
|
<p>Core server settings.</p>
|
|
<dl>
|
|
<dt>host</dt>
|
|
<dd>Bind address. Default: <code>0.0.0.0</code></dd>
|
|
|
|
<dt>port</dt>
|
|
<dd>Listen port. Default: <code>8080</code></dd>
|
|
|
|
<dt>backlog</dt>
|
|
<dd>Connection queue size. Default: <code>5</code></dd>
|
|
|
|
<dt>default_root</dt>
|
|
<dd>Enable default root handler. Default: <code>false</code></dd>
|
|
|
|
<dt>proxy_timeout</dt>
|
|
<dd>Default timeout for proxy requests in seconds. Default: <code>30.0</code></dd>
|
|
|
|
<dt>redirect_instructions</dt>
|
|
<dd>Dictionary of redirect rules. Format: <code>"/from": "/to"</code></dd>
|
|
</dl>
|
|
|
|
<h3>ssl</h3>
|
|
<p>SSL/TLS configuration for HTTPS.</p>
|
|
<dl>
|
|
<dt>enabled</dt>
|
|
<dd>Enable HTTPS. Default: <code>false</code></dd>
|
|
|
|
<dt>cert_file</dt>
|
|
<dd>Path to SSL certificate file. Default: <code>./ssl/cert.pem</code></dd>
|
|
|
|
<dt>key_file</dt>
|
|
<dd>Path to SSL private key file. Default: <code>./ssl/key.pem</code></dd>
|
|
</dl>
|
|
|
|
<h3>logging</h3>
|
|
<p>Logging configuration with structlog support.</p>
|
|
<dl>
|
|
<dt>level</dt>
|
|
<dd>Log level: <code>DEBUG</code>, <code>INFO</code>, <code>WARNING</code>,
|
|
<code>ERROR</code>. Default: <code>INFO</code></dd>
|
|
|
|
<dt>console_output</dt>
|
|
<dd>Output to console. Default: <code>true</code></dd>
|
|
|
|
<dt>format</dt>
|
|
<dd>Format configuration object (see below)</dd>
|
|
|
|
<dt>console</dt>
|
|
<dd>Console handler configuration</dd>
|
|
|
|
<dt>files</dt>
|
|
<dd>List of file handlers for logging to files</dd>
|
|
</dl>
|
|
|
|
<h4>logging.format</h4>
|
|
<dl>
|
|
<dt>type</dt>
|
|
<dd>Format type: <code>standard</code> or <code>json</code>. Default: <code>standard</code></dd>
|
|
|
|
<dt>use_colors</dt>
|
|
<dd>Enable colored output in console. Default: <code>true</code></dd>
|
|
|
|
<dt>show_module</dt>
|
|
<dd>Show module name in logs. Default: <code>true</code></dd>
|
|
|
|
<dt>timestamp_format</dt>
|
|
<dd>Timestamp format string. Default: <code>%Y-%m-%d %H:%M:%S</code></dd>
|
|
</dl>
|
|
|
|
<h4>logging.files[]</h4>
|
|
<dl>
|
|
<dt>path</dt>
|
|
<dd>Path to log file</dd>
|
|
|
|
<dt>level</dt>
|
|
<dd>Log level for this file handler</dd>
|
|
|
|
<dt>format</dt>
|
|
<dd>Format configuration for this file</dd>
|
|
|
|
<dt>loggers</dt>
|
|
<dd>List of logger names to include (empty = all loggers)</dd>
|
|
|
|
<dt>max_bytes</dt>
|
|
<dd>Maximum file size before rotation. Default: <code>10485760</code> (10MB)</dd>
|
|
|
|
<dt>backup_count</dt>
|
|
<dd>Number of backup files to keep. Default: <code>5</code></dd>
|
|
</dl>
|
|
|
|
<h3>extensions</h3>
|
|
<p>List of extension modules to load. See <a href="../reference/extensions.html">Extensions Reference</a>.</p>
|
|
|
|
<h3>Complete Example</h3>
|
|
<pre><span class="directive">http:</span>
|
|
<span class="directive">static_dir:</span> <span class="value">./static</span>
|
|
<span class="directive">templates_dir:</span> <span class="value">./templates</span>
|
|
|
|
<span class="directive">server:</span>
|
|
<span class="directive">host:</span> <span class="value">0.0.0.0</span>
|
|
<span class="directive">port:</span> <span class="value">8080</span>
|
|
<span class="directive">backlog:</span> <span class="value">5</span>
|
|
<span class="directive">default_root:</span> <span class="value">false</span>
|
|
<span class="directive">proxy_timeout:</span> <span class="value">30.0</span>
|
|
|
|
<span class="directive">ssl:</span>
|
|
<span class="directive">enabled:</span> <span class="value">false</span>
|
|
<span class="directive">cert_file:</span> <span class="value">./ssl/cert.pem</span>
|
|
<span class="directive">key_file:</span> <span class="value">./ssl/key.pem</span>
|
|
|
|
<span class="directive">logging:</span>
|
|
<span class="directive">level:</span> <span class="value">INFO</span>
|
|
<span class="directive">console_output:</span> <span class="value">true</span>
|
|
<span class="directive">format:</span>
|
|
<span class="directive">type:</span> <span class="value">standard</span>
|
|
<span class="directive">use_colors:</span> <span class="value">true</span>
|
|
<span class="directive">timestamp_format:</span> <span class="value">"%Y-%m-%d %H:%M:%S"</span>
|
|
<span class="directive">files:</span>
|
|
- <span class="directive">path:</span> <span class="value">./logs/pyserve.log</span>
|
|
<span class="directive">level:</span> <span class="value">DEBUG</span>
|
|
<span class="directive">max_bytes:</span> <span class="value">10485760</span>
|
|
<span class="directive">backup_count:</span> <span class="value">5</span>
|
|
|
|
<span class="directive">extensions:</span>
|
|
- <span class="directive">type:</span> <span class="value">routing</span>
|
|
<span class="directive">config:</span>
|
|
<span class="directive">regex_locations:</span>
|
|
<span class="value">"__default__"</span>:
|
|
<span class="directive">root:</span> <span class="value">"./static"</span>
|
|
<span class="directive">index_file:</span> <span class="value">"index.html"</span></pre>
|
|
|
|
<div class="warning">
|
|
<strong>Warning:</strong> When running in production, always use SSL
|
|
and restrict the bind address appropriately.
|
|
</div>
|
|
</div>
|
|
|
|
<div id="footer">
|
|
<p>pyserve © 2024-2025 | MIT License</p>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html>
|