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/secretexpected 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 type in configuration

Applet/Timing configuration is often used for passing sensitive data - e.g.: tokens, credentials, and passwords. To keep these values protected, use Applet configuration with valueType: secret.

Any values with valueType: secret will be protected from being seen in the Box.

Full example

package.json
"sos": {
"config": [
{
"name": "authToken",
"valueType": "secret",
"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