dwsconfiguration
10 min
\<font color="hsl(var( ab gray 900))">the \</font> \<font color="hsl(var( ab gray 900))">\</font> dwsconfiguration idl \[ 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 var dwsconfigurationclass = require("@brightsign/dwsconfiguration"); var dwsconfig = new dwsconfigurationclass(); dws use this interface to retrieve and modify the dws configuration getconfig() 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() 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 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 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 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)); });