Env variables and configuration
You can add a number of key-value
pairs into the Applet in a form of config.
Config values are unique per device and typically is used for passing:
- custom variables
- tokens and credentials
- any dynamic value that differs per-device
Accessing configuration
Configuration is available within JS SDK under the sos
object.
// Parsed JSON object passed for current applet & current device together
console.log(sos.config);
console.log(sos.config.identification);
console.log(sos.config.yourKey);
Defining configuration in code
Any configuration can be defined as code in package.json
.
You can define multiple configuration in a config array. Each configuration item has the following definition:
Key | Value type | Description |
---|---|---|
name | string | name of the configuration |
valueType | string | url | enum | number | secret | encrypted | expected value type |
list | array of strings | numbers | only for valueType enum, list of predefined options |
mandatory | boolean | required to be filled before building applet or assigning applet |
description | string | description shown in the UI to guide user |
placeholder | string | field placeholder in the UI to guide user; placeholder is never used as default value |
min | number | minimum number value user can fill in to the field |
max | number | maximum number value user can fill in to the field |
secret
and encrypted
type in configuration
Applet/Timing configurations are often used to pass sensitive data, such as tokens, credentials, and passwords. To protect these values, use the Applet configuration with one of these value types.
-
secret
value typeUse this type if you want to mask the value in the Box UI. It is suitable for less sensitive data. The value is stored in the database in its raw form and may be visible, for example, during an Applet/Timing configuration update.
-
encrypted
value type:This type provides stronger protection. The value is encrypted using asymmetric encryption with a provided public key, which is generated for your company on demand. It is stored in encrypted form in the database and cannot be read anywhere, even during an Applet/Timing configuration update.
Full example
"sos": {
"config": [
{
"name": "wifiPassword",
"valueType": "secret",
"mandatory": true,
"description": "A password for the WiFi network.",
},
{
"name": "authToken",
"valueType": "encrypted",
"mandatory": true,
"description": "A token generated by My Control used for authentication against My cloud."
},
{
"name": "myBaseUrl",
"valueType": "URL",
"description": "A base URL to My cloud. No slash at the end required.",
"placeholder": "https://api.signageos.io"
},
{
"name": "playerDuration",
"valueType": "string",
"description": "A length of generated playlist in '##s' format (seconds).",
"placeholder": "172800s"
},
{
"name": "refreshIntervalMs",
"valueType": "number",
"description": "Frequency of trying to generate new playlist from My cloud in milliseconds.",
"placeholder": "65000",
"min": 60000,
"max": 70000
},
{
"name": "playerId",
"valueType": "string",
"description": "An identifier for the device used to identifying against cloud. E.g. platform: SSSP, WEBOS, BRIGHTSIGN, ANDROID, WINDOWS, LINUX",
"placeholder": "{PLATFORM}_{SERIAL_NUMBER}"
},
{
"name": "proxyUrl",
"valueType": "URL",
"description": "A prefix for all HTTP(s) requests done by My player to My cloud. Default is no proxy.",
"placeholder": "https://cors-anywhere.herokuapp.com/"
}
],
"appletUid": "967daxxxxxxx58e27376a5596028"
},
Learn how to assing the configuration values using Box or REST API