Superadmins can now change signup rules (on/off and the domain allow-list) and branding at runtime; the environment variables only seed the defaults. Mail and S3 storage settings pass through to PocketBase's own settings, and docwell-server sends its own emails through a PocketBase hook so there is a single SMTP configuration. The boot hook no longer wipes SMTP settings that were not set from the environment. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
30 lines
990 B
JavaScript
30 lines
990 B
JavaScript
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
/// <reference path="../pb_data/types.d.ts" />
|
|
|
|
// Instance settings the admin panel edits (signup rules, branding), one record
|
|
// per key. Mail and file storage settings live in PocketBase's own settings,
|
|
// which docwell-server patches directly.
|
|
|
|
migrate(
|
|
(app) => {
|
|
const settings = new Collection({
|
|
type: "base",
|
|
name: "instance_settings",
|
|
fields: [
|
|
{ name: "key", type: "text", required: true, max: 64, pattern: "^[a-z0-9_]+$" },
|
|
{ name: "value", type: "json", maxSize: 1048576 },
|
|
{ name: "created", type: "autodate", onCreate: true, onUpdate: false },
|
|
{ name: "updated", type: "autodate", onCreate: true, onUpdate: true },
|
|
],
|
|
indexes: ["CREATE UNIQUE INDEX idx_instance_settings_key ON instance_settings (key)"],
|
|
});
|
|
app.save(settings);
|
|
},
|
|
(app) => {
|
|
try {
|
|
app.delete(app.findCollectionByNameOrId("instance_settings"));
|
|
} catch (_) {}
|
|
},
|
|
);
|