blob: d214312d2be9cdda13488227a9991c384e42a4f9 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
# Example configuration for webmentions-ssg.
#
# This is a Python configuration file (not INI). Change example.com, paths, the
# secret key, and SMTP settings before deploying.
#
# Default location in production: /etc/webmentions-ssg.cfg
import logging
# ---------------------------------------------------------------------------
# Flask / Application
# ---------------------------------------------------------------------------
DEBUG = False
BOOTSTRAP_SERVE_LOCAL = True
# BOOTSTRAP_BOOTSWATCH_THEME = "Materia"
# ---------------------------------------------------------------------------
# Flask / Security
# ---------------------------------------------------------------------------
# Generate a persistent random key, e.g.:
# python -c 'import secrets; print(secrets.token_urlsafe(32))'
# Never commit your real key or SMTP password to version control.
SECRET_KEY = "REPLACE_WITH_A_LONG_RANDOM_SECRET"
# ---------------------------------------------------------------------------
# Database and logging
# ---------------------------------------------------------------------------
# SQLite with an absolute file path (four slashes after sqlite:).
# Ensure the service user can write to this directory.
SQLALCHEMY_DATABASE_URI = "sqlite:////var/lib/webmentions-ssg/webmentions-ssg.db"
SQLALCHEMY_TRACK_MODIFICATIONS = False
# Ensure the service user can write to the log file / directory.
LOG_FILE = "/var/log/webmentions-ssg.log"
LOG_LEVEL = logging.INFO
LOG_FORMAT = "[%(asctime)s]:%(levelname)s:%(name)s %(message)s"
LOGFILE_MAX_BYTES = 20_000_000
LOGFILE_BACKUP_COUNT = 10
# ---------------------------------------------------------------------------
# Receiving Webmentions
# ---------------------------------------------------------------------------
# Required: exact hostnames permitted in the 'target' field of an incoming
# Webmention. Include each hostname you serve; wildcards are not supported.
ALLOWED_HOSTNAMES = {"example.com", "www.example.com"}
# Limits for fetching/verifying incoming sources.
REQUEST_TIMEOUT = 5.0 # seconds; also used for outgoing requests
MAX_REDIRECTS = 20 # also used for outgoing requests
MAX_SOURCE_BYTES = 1_000_000
# ---------------------------------------------------------------------------
# Rate limiting
# ---------------------------------------------------------------------------
# In-memory storage is for development/testing ONLY. Production requires shared
# storage, such as Redis, or the application will refuse to start.
RATELIMIT_STORAGE_URI = "memory://"
RATELIMIT_HEADERS_ENABLED = True
# Limits per client and across all clients for incoming Webmention submissions.
ENDPOINT_RATE_LIMIT = "10/minute;100/hour"
ENDPOINT_GLOBAL_RATE_LIMIT = "1000/hour"
# Minimum seconds between verifications of the same source/target pair.
ENDPOINT_REVERIFY_COOLDOWN_SECONDS = 600
# Limit login POST attempts per client.
LOGIN_RATE_LIMIT = "5/minute;30/hour"
# ---------------------------------------------------------------------------
# Sending Webmentions from a statically generated site
# ---------------------------------------------------------------------------
# Folder containing generated pages named index.html. Set to None to disable
# scanning. Its root-level index.html is not scanned.
SOURCE_DIRECTORY = "/var/www/example.com/public"
# Needed for pages without absolute canonical URLs.
SOURCE_BASE_URL = "https://example.com/"
# Huey cron expression: minute hour day-of-month month day-of-week.
SCANNER_SCHEDULE = "0 * * * *" # every hour
# Do not send Webmentions to your own site. Glob patterns are supported here.
IGNORED_HOSTNAMES = ("example.com", "*.example.com")
MAX_TARGET_BYTES = 1_000_000
# ---------------------------------------------------------------------------
# Background tasks (Huey)
# ---------------------------------------------------------------------------
# Use a shared, persistent backend for production app and worker processes.
# Redis must be running and reachable by both.
HUEY_URL = "redis://127.0.0.1:6379/0"
# ---------------------------------------------------------------------------
# Email notifications for newly verified received Webmentions
# ---------------------------------------------------------------------------
# Set NOTIFICATION_EMAIL = None to disable notification emails.
NOTIFICATION_EMAIL = "admin@example.com"
# Daily notification digest at 08:00 UTC (Huey defaults to UTC).
NOTIFICATION_SCHEDULE = "0 8 * * *"
# Example SMTP-over-STARTTLS setup; adapt to your mail provider.
MAIL_SERVER = "smtp.example.com"
MAIL_PORT = 587
MAIL_USE_TLS = True
MAIL_USE_SSL = False
MAIL_USERNAME = "webmentions@example.com"
MAIL_PASSWORD = "REPLACE_WITH_SMTP_PASSWORD"
MAIL_DEFAULT_SENDER = "webmentions@example.com"
|