55945fd6b449c68985adc2ab4439b62c2e8c04ee
[squeep-indie-auther] / 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.
15 nodeId: common.requestId(), // Default to ephemeral ID: easiest for clustered deployments.
16
17 encryptionSecret: '', // No default; set this to a long passphrase or randomness.
18 // This may also be set to an array, if secret needs to be rolled. This needs more documentation.
19
20 // Dingus API Server Framework options.
21 dingus: {
22 // This needs to be the full externally accessible root URL, including any proxyPrefix component.
23 selfBaseUrl: '',
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. /indieauth
27 },
28
29 // The terminal portions of API route path endpoints.
30 route: {
31 authorization: 'auth',
32 consent: 'consent',
33 healthcheck: 'healthcheck',
34 introspection: 'introspect',
35 metadata: 'meta',
36 revocation: 'revoke',
37 ticket: 'ticket',
38 token: 'token',
39 userinfo: 'userinfo',
40 },
41
42 // Database options
43 db: {
44 connectionString: '', // e.g. sqlite://path/to/dbfile.sqlite
45 queryLogLevel: undefined, // Set to log queries
46
47 // SQLite specific options
48 sqliteOptimizeAfterChanges: 0, // Number of changes before running pragma optimize, 0 for never
49 },
50
51 // Queue options, currently only for handing off ticket offers
52 queues: {
53 amqp: {
54 url: undefined, // AMQP endpoint, e.g. 'amqp://user:pass@rmq.host:5672' If not specified, ticket endpoint will be disabled
55 prefix: undefined,
56 },
57 ticketPublishName: 'indieauth.ticket.proffered', // exchange to publish proffered tickets to
58 },
59
60 // Logging options
61 logger: {
62 ignoreBelowLevel: 'info',
63 },
64
65 manager: {
66 codeValidityTimeoutMs: 10 * 60 * 1000,
67 ticketLifespanSeconds: 300,
68 pageTitle: packageName, // title on html pages
69 logoUrl: 'static/logo.svg', // image to go with title
70 footerEntries: [ // common footers on all html pages
71 '<a href="https://git.squeep.com/?p=squeep-indie-auther;a=tree">Development Repository</a>',
72 `<span class="copyright">&copy;<time datetime="${currentYear}">${romanYearHTML}</time></span>`,
73 ],
74 allowLegacyNonPKCE: false, // Whether to process auth requests lacking code challenges
75 },
76
77 chores: {
78 scopeCleanupMs: 0, // how often to clean up unreferenced scopes, 0 for never
79 tokenCleanupMs: 0, // how often to clean up no-longer-valid scopes, 0 for never
80 },
81
82 // Outgoing request UA header. Setting these here to override helper defaults.
83 userAgent: {
84 product: packageName,
85 version: packageVersion,
86 implementation: Enum.Specification,
87 },
88
89 authenticator: {
90 authnEnabled: ['argon2', 'pam'], // Types of authentication to attempt.
91 secureAuthOnly: true, // Require secure transport for authentication.
92 forbiddenPAMIdentifiers: [
93 'root',
94 ],
95 },
96
97 };
98
99 module.exports = defaultOptions;