update dependencies, devDependencies, copyright
[websub-hub] / config / default.js
1 'use strict';
2
3 // Provide default values for all configuration.
4
5 const { name: packageName, version: packageVersion } = require('../package.json');
6 const common = require('../src/common');
7 const Enum = require('../src/enum');
8 const roman = require('@squeep/roman');
9
10 const currentYear = (new Date()).getFullYear();
11 const romanYearHTML = roman.toRoman(currentYear, true);
12
13 const defaultOptions = {
14 // Uniquely identify this instance, used to tag work-in-progress.
15 nodeId: common.requestId(), // Default to ephemeral ID: easiest for clustered deployments.
16
17 // This should be set to a reasonably long passphrase or random buffer, to keep client session data secure.
18 encryptionSecret: undefined, // REQUIRED
19
20 // Dingus API Server Framework options. Be sure to set the one REQUIRED option here.
21 dingus: {
22 // This needs to be the full externally accessible root URL, including any proxyPrefix component, which clients will connect to, and which topics will list as their hub link.
23 selfBaseUrl: '', // REQUIRED
24
25 // trustProxy: true, // If true, trust values of some headers regarding client IP address and protocol.
26 proxyPrefix: '', // Leading path parts to ignore when parsing routes, and include when constructing links, e.g. /hub
27 },
28
29 // Database options
30 db: {
31 connectionString: '', // e.g. sqlite://path/to/dbfile.sqlite
32 queryLogLevel: undefined, // Set to log queries
33 cacheEnabled: true, // Cache some db responses. (Postgres only)
34 listener: { // Settings for the cache-invalidator connection. (Postgres only)
35 // pingDelayMs: 5000, // Connection keep-alive/health-check.
36 // reconnectDelayMs: 6000, // Wait time before attempting reconnection.
37 // reconnectTimes: 10, // Retries limit.
38 },
39 },
40
41 // Logging options
42 logger: {
43 ignoreBelowLevel: 'info',
44 },
45
46 // Lease time limits, if not specified per-topic. Comments are defaults in code.
47 topicLeaseDefaults: {
48 // leaseSecondsPreferred: 86400 * 10,
49 // leaseSecondsMin: 86400 * 1,
50 // leaseSecondsMax: 86400 * 365,
51 },
52
53 manager: {
54 pageTitle: packageName, // title on html pages
55 logoUrl: 'static/logo.svg', // image to go with title
56 footerEntries: [ // common footers on all html pages
57 '<a href="https://git.squeep.com/?p=websub-hub;a=tree">Development Repository</a> / <a href="https://github.com/thylacine/websub-hub/">GitHub mirror</a>',
58 '<span class="copyright">&copy;<time datetime="${currentYear}">${romanYearHTML}</time></span>',
59 ],
60 publishHistoryDays: 60, // Number of days of update history to show on topic details page
61 strictSecrets: false, // If true, reject requests with secrets but not over https
62 publicHub: true, // Accept publish requests as new topics.
63 processImmediately: true, // If true, immediately attempt to process requests when accepted.
64 },
65
66 communication: {
67 requestTimeoutMs: 120000,
68 strictTopicHubLink: true, // If true, deletes topics which do not list us (dingus.selfBaseUrl) as a hub relation.
69 retryBackoffSeconds: [60, 120, 360, 1440, 7200, 43200, 86400], // failed requests retry according to number of attempts
70 claimTimeoutSeconds: 600, // how long until an in-progress task is deemed abandoned
71 },
72
73 // Outgoing request UA header.
74 // These values are the same as the defaults in the code, but we are setting
75 // them here so they also apply to UA of other modules, e.g. @squeep/indieauth-helper
76 userAgent: {
77 product: packageName,
78 version: packageVersion,
79 implementation: Enum.Specification,
80 },
81
82 authenticator: {
83 basicRealm: packageName, // Realm prompt for login on administration pages
84 secureAuthOnly: true, // Require secure transport for authentication.
85 authnEnabled: ['indieAuth', 'argon2', 'pam'],
86 forbiddenPAMIdentifiers: ['root'],
87 },
88
89 worker: {
90 concurrency: 10, // maximum number of tasks to process at once
91 pollingEnabled: true, // periodically check for new tasks
92 recurrSleepMs: 60000, // check this often
93 },
94
95 };
96
97 module.exports = defaultOptions;