Skip to main content

Class: SystemSettingsUtils

Defined in: auth/src/routes/SystemSettingsUtils.ts:27

Utility class for reading and writing the SystemSettings at runtime.

The settings are stored as a single record under SYSTEM_SETTINGS_UID. The record is created on first access, seeded from the server configuration, and from then on the stored values take precedence so that an administrator can change them without restarting (or reconfiguring) the server.

Instantiate via ObjectFactory so that every route shares one instance per settings class, e.g.:

await objectFactory.newInstance(SystemSettingsUtils, { name: SystemSettingsSQL.name, args: [SystemSettingsSQL] });

Constructors​

Constructor​

new SystemSettingsUtils(settingsClass): SystemSettingsUtils

Defined in: auth/src/routes/SystemSettingsUtils.ts:46

Parameters​

settingsClass​

any

Returns​

SystemSettingsUtils

Properties​

allowMultiplePasswords​

protected allowMultiplePasswords: boolean = false

Defined in: auth/src/routes/SystemSettingsUtils.ts:35


allowRegistration​

protected allowRegistration: boolean = true

Defined in: auth/src/routes/SystemSettingsUtils.ts:29


logger​

protected logger: any

Defined in: auth/src/routes/SystemSettingsUtils.ts:38


repo?​

protected optional repo?: RepoUtils<SystemSettingsEntity>

Defined in: auth/src/routes/SystemSettingsUtils.ts:40


requireMFA​

protected requireMFA: boolean = false

Defined in: auth/src/routes/SystemSettingsUtils.ts:32


settingsClass​

protected settingsClass: any

Defined in: auth/src/routes/SystemSettingsUtils.ts:41

Methods​

get()​

get(): Promise<SystemSettings>

Defined in: auth/src/routes/SystemSettingsUtils.ts:107

Returns the effective settings, falling back to @Config for any value that isn't stored or can't be read.

Returns​

Promise<SystemSettings>


getEntity()​

getEntity(): Promise<SystemSettingsEntity>

Defined in: auth/src/routes/SystemSettingsUtils.ts:68

Returns the persisted settings record, creating it seeded from @Config if it doesn't exist yet. Two concurrent first reads racing to create the record are tolerated: the loser re-reads the winner's record.

Returns​

Promise<SystemSettingsEntity>


init()​

protected init(): Promise<void>

Defined in: auth/src/routes/SystemSettingsUtils.ts:51

Returns​

Promise<void>


update()​

update(changes): Promise<SystemSettings>

Defined in: auth/src/routes/SystemSettingsUtils.ts:129

Applies the given partial update to the persisted settings and returns the new effective settings. An omitted key is left untouched. Unlike the settings this replaced (site branding's allowRegistration), SystemSettings intentionally has no "revert to @Config" sentinel: once the record is seeded, its stored values are always authoritative, so null (and any other non-boolean value) is rejected rather than silently accepted as a way to clear a field back to configuration.

Parameters​

changes​

Partial<SystemSettings>

Returns​

Promise<SystemSettings>