Rustelo/scripts/docs/generate-content.sh

111 lines
3.6 KiB
Bash
Raw Normal View History

2025-07-07 23:53:50 +01:00
#!/bin/bash
# Generate dynamic content for documentation
set -e
PROJECT_ROOT="$(dirname "$0")/.."
cd "$PROJECT_ROOT"
echo "📝 Generating dynamic documentation content..."
# Generate feature matrix
echo "Generating feature matrix..."
cat > book/appendices/feature-matrix.md << 'MATRIX_EOF'
# Feature Matrix
This matrix shows which features are available in different configurations.
| Feature | Minimal | Auth | Content | Email | TLS | Full |
|---------|---------|------|---------|-------|-----|------|
| Static Files |||||||
| Routing |||||||
| Security Headers |||||||
| JWT Auth |||||||
| OAuth2 |||||||
| 2FA/TOTP |||||||
| Database Content |||||||
| Markdown Rendering |||||||
| Email System |||||||
| HTTPS/TLS |||||||
## Build Commands
```bash
# Minimal
cargo build --no-default-features
# Authentication only
cargo build --no-default-features --features "auth"
# Content management only
cargo build --no-default-features --features "content-db"
# Email only
cargo build --no-default-features --features "email"
# TLS only
cargo build --no-default-features --features "tls"
# Full featured
cargo build --features "auth,content-db,email,tls"
```
MATRIX_EOF
# Generate environment variables reference
echo "Generating environment variables reference..."
cat > book/appendices/env-variables.md << 'ENV_EOF'
# Environment Variables Reference
This document lists all environment variables used by Rustelo.
## Core Variables
| Variable | Description | Default | Required |
|----------|-------------|---------|----------|
| `SERVER_HOST` | Server bind address | `127.0.0.1` | No |
| `SERVER_PORT` | Server port | `3030` | No |
| `SERVER_PROTOCOL` | Protocol (http/https) | `http` | No |
| `ENVIRONMENT` | Environment (DEV/PROD) | `DEV` | No |
| `LOG_LEVEL` | Log level | `info` | No |
## Database Variables (auth, content-db features)
| Variable | Description | Default | Required |
|----------|-------------|---------|----------|
| `DATABASE_URL` | Database connection URL | - | Yes |
| `DATABASE_MAX_CONNECTIONS` | Maximum connections | `10` | No |
| `DATABASE_MIN_CONNECTIONS` | Minimum connections | `1` | No |
## Authentication Variables (auth feature)
| Variable | Description | Default | Required |
|----------|-------------|---------|----------|
| `JWT_SECRET` | JWT signing secret | - | Yes |
| `JWT_EXPIRATION_HOURS` | JWT expiration | `24` | No |
| `GOOGLE_CLIENT_ID` | Google OAuth client ID | - | No |
| `GOOGLE_CLIENT_SECRET` | Google OAuth secret | - | No |
| `GITHUB_CLIENT_ID` | GitHub OAuth client ID | - | No |
| `GITHUB_CLIENT_SECRET` | GitHub OAuth secret | - | No |
## TLS Variables (tls feature)
| Variable | Description | Default | Required |
|----------|-------------|---------|----------|
| `TLS_CERT_PATH` | TLS certificate path | - | Yes |
| `TLS_KEY_PATH` | TLS private key path | - | Yes |
## Email Variables (email feature)
| Variable | Description | Default | Required |
|----------|-------------|---------|----------|
| `EMAIL_PROVIDER` | Email provider | `console` | No |
| `EMAIL_FROM_ADDRESS` | Default from address | - | Yes |
| `EMAIL_FROM_NAME` | Default from name | - | No |
| `SMTP_HOST` | SMTP server host | - | Conditional |
| `SMTP_PORT` | SMTP server port | `587` | Conditional |
| `SMTP_USERNAME` | SMTP username | - | Conditional |
| `SMTP_PASSWORD` | SMTP password | - | Conditional |
ENV_EOF
echo "✅ Dynamic content generated"