# Class Configuration#setServerProperty

Configuration

- Defined in: configuration.js

Class Summary
Constructor Attributes | Constructor Name and Description
--- | ---
| Configuration#setServerProperty(successCallback, errorCallback, options) Sets the server property.

## Class Detail

Configuration#setServerProperty(successCallback, errorCallback, options)
Sets the server property.

scap_installation.json
If scap_installation.json file exists under root directory of usb memory and 'Auto Set' is enabled in server settings menu, server properties will be set as described in scap_installation.json and 'Auto Set' will be disabled automatically. Factory default setting of 'Auto Set' is 'enabled'. scap_installation.json schema is as below.

    {
      "$schema": "http://json-schema.org/draft-04/schema#",
      "id": "",
      "type": "object",
      "properties": {
        "serverIp": {
          "id": "serverIp",
          "type": "string"
        },
        "serverPort": {
          "id": "serverPort",
          "type": "integer"
        },
        "secureConnection": {
          "id": "secureConnection",
          "type": "boolean"
        },
        "appLaunchMode": {
          "id": "appLaunchMode",
          "type": "string",
          "enum": [
            "local",
            "usb",
            "remote"
          ]
        },
        "fqdnMode": {
          "id": "fqdnMode",
          "type": "boolean"
        },
        "fqdnAddr": {
          "id": "fqdnAddr",
          "type": "string"
        },
        "required": [
          "serverIp",
          "serverPort",
          "secureConnection",
          "appLaunchMode",
          "fqdnMode",
          "fqdnAddr"
        ]
      }
    }

scap_installation.json example is as below.
{
"serverIp":"10.177.211.51",
"serverPort":80,
"secureConnection":false,
"appLaunchMode":"local",
"fqdnMode":true,
"fqdnAddr":"http://192.168.0.1:2000/lgapp.zip"
}

    // Javascript code
    function setServerProperty () {
      var options = {
         serverIp : "192.168.0.2",
         serverPort : 80,
         secureConnection : false,
         appLaunchMode : Configuration.AppMode.REMOTE,
         appType : Configuration.AppType.ZIP,
         fqdnMode : false,
         fqdnAddr : "http://signage.domain.com/index.html"
      };

      function successCb() {
         // Do something
      }

      function failureCb(cbObject) {
         var errorCode = cbObject.errorCode;
         var errorText = cbObject.errorText;
         console.log ("Error Code [" + errorCode + "]: " + errorText);
      }

      var configuration = new Configuration();
      configuration.setServerProperty(successCb, failureCb, options);
    }

Parameters:
{Function} successCallback
  success callback function.
{Function} errorCallback
  failure callback function.
{Object} options

  Property | Type | Description | Required
  --- | --- | --- | ---
  serverIp | String | IP address (local, usb : to upgrade / remote : to launch ) | required
  serverPort | Number | Port number (local, usb : to upgrade / remote : to launch ) | required
  secureConnection | Boolean | true : https, false : http | required
  appLaunchMode | String | launch mode Configuration.AppMode | required
  appType | String | app type Configuration.AppType | optional
  fqdnMode | Boolean | true : use fqdn settings when an application upgrades or launches, false : use serverIp and serverPort settings when an application upgrades or launches | required
  fqdnAddr | String | FQDN url. for example, http://lge.com/index.html or https://lge.com/index.html | required

Since:
  1.1
Returns:

  If the method is successfully executed, success callback function is called without a parameter. If an error occurs, failure callback function is called with a failure callback object as a parameter.

See:
  Configuration.getServerProperty()