Skip to main content

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.

Accessing applet configuration
// 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:

KeyValue typeDescription
namestringname of the configuration
valueTypestring | url | enum | number | secret | encryptedexpected value type
listarray of strings | numbersonly for valueType enum, list of predefined options
mandatorybooleanrequired to be filled before building applet or assigning applet
descriptionstringdescription shown in the UI to guide user
placeholderstringfield placeholder in the UI to guide user; placeholder is never used as default value
minnumberminimum number value user can fill in to the field
maxnumbermaximum 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 type

    Use 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

package.json
"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"
},
Setting configuration values

Learn how to assing the configuration values using Box or REST API