ForgeOpenPlatform
en

OpenPlatform

OpenPlatform settings, services and database tables

OpenPlatform · openplatform@5 openplatformsettingsdatabaseservices

The settings

OpenPlatform keeps its configuration in the table cl_config and loads it into Total.js CONF at start and every eight hours (definitions/init.js). The setup screen reads and saves these keys (plugins/setup/schemas/settings.js):

KeyMeaning
name, icon, colorthe name, logo and colour of the platform
urlthe public address of the platform (without the final /). Changing it clears the notification links and the open application sessions
languagethe default language
mail_smtp, mail_smtp_options, mail_fromthe SMTP server, its options (JSON) and the sender; the setup screen can test them
$tms, secret_tmspublish the events by TMS, and the secret of that connection
allow_token, tokenenable the public GET /users/ API and its token
newtabopen every application in a new tab
sync, sync_tokenaccept the /sync/ socket of other instances, with its token

The first start (database.sql) also generates, inside cl_config, values that the setup screen does not edit: the installation id, the authentication secret, the cookie name, the salt of the passwords, the saltchecksum of the checksums and the secret of the TMS connection. It creates the keys with these defaults:

KeyDefaultMeaning
auth_cookie_expire1 monthhow long the session cookie lives
auth_expire5 minuteshow long the signed-in user is kept in memory before it is read again
auth_cookie_options{"httponly":true,"security":"lax"}the options of the session cookie
auth_strictfalsestrict sessions
app_session_expire1 dayhow long an application session lasts
cdnhttps://cdn.componentator.com/the CDN of the interface
languageeuthe default language
token, sync_tokengeneratedthe token of the users API and of the sync socket (both features are off by default)

The key servicetoken, which the image upload endpoint compares with its query token, is not created by the script and the setup screen does not edit it: it exists only if you add it to cl_config yourself.

The script also creates the group Admin and the first user (info@totaljs.com, administrator, confirmed) that belongs to it; see installing it.

The background services

Total.js runs a service every minute. OpenPlatform uses it (definitions/init.js) to:

  • clear the in-memory cache of the verifications (every 2 minutes);
  • save the daily statistics: users online, the maximum and the number by device (every 3 minutes);
  • reload the configuration from the database (every 8 hours);
  • delete the expired application sessions and platform sessions (every 12 hours);
  • send the email digests of unread notifications (every 11 minutes, when the mail is configured).

The database

Everything lives in the PostgreSQL schema op:

TableWhat it holds
cl_configthe configuration (key, value, type)
tbl_userthe users: profile, password hash, flags, counters and the cached permissions
tbl_groupthe groups
tbl_user_groupwhich user belongs to which group
tbl_sessionthe sessions of the users in the portal (device, address, expiry)
tbl_appthe applications: address, secrets, flags and allowed addresses
tbl_app_permissionthe permissions that each application declares
tbl_group_permissionwhich permissions (or just which applications) each group grants
tbl_app_sessionthe launch sessions of the applications and their derived tokens
tbl_user_appper user and application: the notification links and whether they accept notifications
tbl_notificationthe notifications
tbl_visitorthe daily visitor statistics
tbl_feedbackthe feedback that users send from the portal

The dated files database-2023-09-15.sql, database-2024-03-21.sql, database-2024-10-22.sql and database-2024-10-30.sql in the repository are the changes of the schema over time, and database.sql is the full script that the first start runs. Back up this schema like any other PostgreSQL database.