OpenPlatform settings, services and database tables
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):
| Key | Meaning |
|---|---|
name, icon, color | the name, logo and colour of the platform |
url | the public address of the platform (without the final /). Changing it clears the notification links and the open application sessions |
language | the default language |
mail_smtp, mail_smtp_options, mail_from | the SMTP server, its options (JSON) and the sender; the setup screen can test them |
$tms, secret_tms | publish the events by TMS, and the secret of that connection |
allow_token, token | enable the public GET /users/ API and its token |
newtab | open every application in a new tab |
sync, sync_token | accept 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:
| Key | Default | Meaning |
|---|---|---|
auth_cookie_expire | 1 month | how long the session cookie lives |
auth_expire | 5 minutes | how 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_strict | false | strict sessions |
app_session_expire | 1 day | how long an application session lasts |
cdn | https://cdn.componentator.com/ | the CDN of the interface |
language | eu | the default language |
token, sync_token | generated | the 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:
| Table | What it holds |
|---|---|
cl_config | the configuration (key, value, type) |
tbl_user | the users: profile, password hash, flags, counters and the cached permissions |
tbl_group | the groups |
tbl_user_group | which user belongs to which group |
tbl_session | the sessions of the users in the portal (device, address, expiry) |
tbl_app | the applications: address, secrets, flags and allowed addresses |
tbl_app_permission | the permissions that each application declares |
tbl_group_permission | which permissions (or just which applications) each group grants |
tbl_app_session | the launch sessions of the applications and their derived tokens |
tbl_user_app | per user and application: the notification links and whether they accept notifications |
tbl_notification | the notifications |
tbl_visitor | the daily visitor statistics |
tbl_feedback | the 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.