2026-09-11 02:46:56 +02:00
|
|
|
import type { Core } from '@strapi/strapi';
|
|
|
|
|
|
|
|
|
|
import { revokePublicAuthActions } from './auth-permissions';
|
|
|
|
|
import { LOG_PREFIX } from './constants';
|
|
|
|
|
import { ensureLocales } from './locales';
|
|
|
|
|
import { ensurePublicPermissions } from './public-permissions';
|
2026-09-24 00:55:47 +02:00
|
|
|
import { ensureReminderSettings } from './reminder-settings';
|
2026-09-11 02:46:56 +02:00
|
|
|
|
|
|
|
|
export { revokePublicAuthActions } from './auth-permissions';
|
|
|
|
|
export { ensureLocales } from './locales';
|
|
|
|
|
export { ensurePublicPermissions } from './public-permissions';
|
2026-09-24 00:55:47 +02:00
|
|
|
export { ensureReminderSettings } from './reminder-settings';
|
2026-09-11 02:46:56 +02:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Boot-time reconciliation, run from `src/index.ts`.
|
|
|
|
|
*
|
|
|
|
|
* Every step is idempotent: the first two only add what is missing, and the
|
|
|
|
|
* third only removes grants this site has decided it never wants. Running the
|
|
|
|
|
* lot on each boot - including on every hot reload in development - leaves an
|
|
|
|
|
* already-reconciled instance untouched.
|
|
|
|
|
*
|
|
|
|
|
* Runs after the plugin bootstraps, so the `en` locale and the Public role that
|
|
|
|
|
* Strapi creates on a fresh database already exist here - including the auth
|
|
|
|
|
* permissions users-permissions grants that role by default, which is exactly
|
|
|
|
|
* what the third step takes back.
|
|
|
|
|
*/
|
|
|
|
|
export const runBootstrap = async ({ strapi }: { strapi: Core.Strapi }): Promise<void> => {
|
|
|
|
|
await ensureLocales(strapi);
|
|
|
|
|
await ensurePublicPermissions(strapi);
|
|
|
|
|
await revokePublicAuthActions(strapi);
|
2026-09-24 00:55:47 +02:00
|
|
|
await ensureReminderSettings(strapi);
|
2026-09-11 02:46:56 +02:00
|
|
|
|
|
|
|
|
strapi.log.debug(`${LOG_PREFIX} bootstrap complete.`);
|
|
|
|
|
};
|