prep command group handles system preparation tasks that should be run before launching Ayase Quart for the first time, or after configuration changes.
Usage
Subcommands
secret
Generate a secure secret key in yourconfig.toml file. This replaces the default placeholder DEFAULT_CHANGE_ME with a cryptographically secure 48-character hexadecimal string.
The new secret will be automatically written to your config file. The original value must be
DEFAULT_CHANGE_ME or the command will report “No default secret found”.- Initial system setup
- Rotating security credentials
- After cloning the repository
- Uses Python’s
secrets.token_hex(24)for cryptographic randomness (src/ayase_quart/cli/prep_cli.py:40) - Performs in-place replacement in the config file
- Prints the new secret for your records
hashjs
Generate SHA-384 integrity hashes for all JavaScript files in the static directory. Creates or updatesasset_hashes.json for Content Security Policy (CSP) enforcement.
asset_hashes.json with contents like:
- After modifying JavaScript files
- During deployment preparation
- When enabling strict CSP policies
- Recursively scans all
.jsfiles instatic/js/(src/ayase_quart/cli/prep_cli.py:46) - Uses SHA-384 hashing with base64 encoding
- Output file location:
cli/asset_hashes.json
boards
Validate that all boards defined in yourboards.toml configuration exist in the database. Creates missing boards if needed.
- After adding new boards to
boards.toml - Initial database setup
- Verifying database schema integrity
- Calls
validate_boards_in_db()from the boards module (src/ayase_quart/cli/prep_cli.py:51-52) - Ensures database schema matches configuration
- Non-destructive operation (only adds missing boards)
filtercache
Populate the moderation filter cache. This preloads filtering rules into memory for faster moderation decisions.This command only has effect if moderation filtering is enabled in your configuration.
- After updating moderation filter rules
- Initial system setup with moderation enabled
- Performance optimization
- Runs asynchronously using
asyncio.run()(src/ayase_quart/cli/prep_cli.py:56-57) - Calls
fc._create_cache()from the moderation module - Cache contents depend on your moderation configuration
Complete setup workflow
Error handling
| Scenario | Output | Action |
|---|---|---|
| Config file not found | Exception printed | Check CONF_FILE path in logs |
| Default secret not found | No default secret found | Secret already changed or invalid config |
| No JS files found | Empty asset_hashes.json | Verify static/js/ directory exists |
File locations
Main configuration file where the secret is stored
Board definitions that are validated against the database
Generated file containing JavaScript integrity hashes
Source directory for JavaScript files to be hashed