---
title: dwsconfiguration
slug: develop/dwsconfiguration
docTags: 
createdAt: 2025-03-11T07:07:19.526Z
---

<font color="hsl(var(--ab-gray-900))">The *dwsconfiguration* object allows you to configure the  on the player. </font>

<font color="hsl(var(--ab-gray-900))">he LDWS is enabled on port 80, with the player serial number as password and "admin" as the username.</font>

**dwsconfiguration IDL**

```text
[
   GarbageCollected,
] interface DWS {
    DWSConfig defaultConfig();
    Promise<DWSConfig> getConfig();
    Promise<DWSResult> applyConfig(DWSConfigWritable config);
};

interface DWSConfig {
    attribute int port;
    attribute Password password;
    attribute Array<String> authenticationList;
};

interface DWSConfigWritable : DWSConfig {
    attribute Password password;
};

interface Password {
    attribute String value;
    attribute bool obfuscated;
};

interface DWSResult {
    attribute bool restartRequired;
};
```

## Object Creation

To create a *dwsconfiguration* object, first load the `brightsign/dwsconfiguration` module using the `require()` method. Then create an instance of the *dwsconfiguration* class.

```javascript
var DWSConfigurationClass = require("@brightsign/dwsconfiguration");
var dwsConfig = new DWSConfigurationClass();
```

## DWS

Use this interface to retrieve and modify the DWS configuration.

### getConfig()

```javascript
Promise <DWSConfig> getConfig() 
```

Returns a `DWSConfig` interface containing current DWS-configuration information. If there is a set password, `getConfig()` will return True for the `password` parameter. If there isn't a set password, If there is a set password, `getConfig()` will return False for the `password` parameter.

### applyConfig()

```javascript
Promise <DWSResult> applyConfig(DWSConfigWritable config) 
```

Applies DWS-configuration settings to the player. This method accepts a `DWSConfig` interface. It returns a `DWSResult` interface that indicates whether or not a reboot is required for the changes to take effect (the caller is responsible for requesting the reboot). The `restartRequired` property of the `DWSResult` indicates whether the reboot is required.

The `config` parameter should contain the complete desired configuration. Any previous configuration is overwritten. If you wish to change one item while keeping the rest of the configuration the same, then call `getConfig` and modify the returned object (see the example in the Examples section).

## DWSConfig

This interface contains DWS configuration parameters:

- `port` <font color="#704ae0">int</font>: The port number of the DWS, located at the IP address of the player. The default for the DWS is port 80. Setting this value to 0 will disable the DWS. 
- `password` <font color="#704ae0">Password</font>: A `Password` interface containing password settings for the DWS. We highly recommended that you set a strong password, especially in production scenarios. To enable the DWS without password protection, set `value` to an empty string and `obfuscated` to false.
- `authenticationList` <font color="#704ae0">Array</font>: The authentication scheme for the DWS password. This entry currently accepts a single value only. The following are accepted values:
  - `"basic"`: The password will be validated using basic authentication.
  - `"digest"`: The password will be validated using digest access authentication.

:::hint{type="info"}
To enable the DWS without password authentication, set the `password.value` to be an empty string and `password.obfuscated` to be false, when calling the `applyConfig()` method.
:::

## DWSConfigWritable

- `password` <font color="#704ae0">Password</font>: A `Password` interface containing password settings for the DWS

## Password

This interface contains password settings for the DWS:

- `value` <font color="#704ae0">String</font>: The DWS password
- `obfuscated` <font color="#704ae0">bool</font>: A flag indicating whether the password string is obfuscated. Contact [support@brightsign.biz](mailto\:support@brightsign.biz) to learn more about generating a key for obfuscation and storing it on the player.

## DWSResult

This interface contains results from an `applyConfig()` operation.

- `restartRequired` <font color="#704ae0">bool</font>: A flag indicating whether a reboot is required for changes to go into effect (the script must perform the reboot)

## Examples

```javascript
var DWSConfigurationClass = require("@brightsign/dwsconfiguration");
var dwsConfig = new DWSConfigurationClass();

var configData = {};
var pw = {};

configData.port = 1010;
configData.password = pw;
configData.authenticationList = ["basic"];

pw.value = "password";
pw.obfuscated = false;

dwsConfig.applyConfig(configData).then(
        function(data) {
            console.log(JSON.stringify(data));
        })
    .catch(
        function(data) {
            console.log(JSON.stringify(data));
        });
dwsConfig.getConfig().then(
        function(data) {
            console.log(JSON.stringify(data));
        })
    .catch(
        function(data) {
            console.log(JSON.stringify(data));
        });
```

To change one item while keeping the rest of the configuration the same, then call `getConfig` and modify the returned object:

```text
  var DWSConfigurationClass = require("@brightsign/dwsconfiguration");
  var dwsConfig = new DWSConfigurationClass();
  var pw = {};
  dwsConfig.getConfig()
  .then(function(config) {
    pw.value = "password";
    pw.obfuscated = false;
    config.password = pw;
    dwsConfig.applyConfig(config);
  })
  .then(function() {
    console.log("Success");
  })
  .catch(function(error) {
    console.log(JSON.stringify(error));
  });
```

