Module

config

Configuration

View Source config.js, line 1

Members

module:config~DefaultConfig

# protected inner config

SDK configurations object

View Source config.js, line 43

module:config~DefaultConfig

# protected inner constant defaultConfig

Default SDK configuration options

View Source config.js, line 22

Methods

# inner get(key) → {string}

Get a single property from the configuration.

Parameters:
Name Type Description
key string

Config key

View Source config.js, line 63

key Config key

string

# inner getAll() → {module:config~DefaultConfig}

Returns the current keys and values of the config.

View Source config.js, line 73

Returns a clone of the config object. NOTE: Uses a clone so that the user cannot directly access the config object.

# inner init(initialConfig) → {module:config~DefaultConfig}

Set all properties of the configuration.

Can only be called once; however, configuration can be reset using module:config~reset, then this method can be called again. (Although, this is not recommended.)

NOTE: This is a much safer configuration approach than the set method, as it eliminates some potential edges case issues for PII-enabled programs.

Parameters:
Name Type Description
initialConfig module:config~DefaultConfig

Configuration values that will override default values.

View Source config.js, line 122

Frozen config object.

# inner reset()

Reset the configuration to defaults and allow module:config~init to be called again.

View Source config.js, line 104

# inner set(key, value) → {*}

Set a property of the configuration

Parameters:
Name Type Description
key string

Key of a configuration property

value *

Value of a configuration property

Deprecated:
  • since version 1.3.0

View Source config.js, line 85

The value given.

*

Type Definitions

# DefaultConfig

Default SDK configuration options type

Properties:
Name Type Attributes Default Description
clientId string

RewardOps API OAuth client_id.

clientSecret string

RewardOps API OAuth client_secret.

apiServerUrl string <optional>

API server URL that the SDK will use for requests. If unset, the SDK uses module:urls~getApiServerUrl to derive the server URL.

apiVersion string <optional>
'v4'

Version of the RewardOps API to use for requests. This affects the SDK methods available and the API baseUrl.

piiServerUrl string <optional>

Geographic-specific PII storage server URL that the SDK will use for requests.

supportedLocales Array <optional>

List of accepted locales for the program, in the format of Accept-Language as per RFC2616; e.g. en-CA, en-US

timeout number <optional>
20000

Timeout for HTTP requests (used by Request library).

logFilePath string <optional>
'<parent dir>/logs/ro.log'

Path for log output file.

logToFile boolean <optional>
false

If true and if config.verbose is true, saves log messages to file.

silent boolean <optional>
false

Suppress console logging.

verbose boolean <optional>
false

Run SDK with verbose logging. NOTE: Superseded by silent if both are true.

quiet boolean <optional>
false

Run SDK with minimal logging. NOTE: Superseded by verbose if both are true.

View Source config.js, line 156