setConfig()

RTMP/E

 setConfig(key:String, value:String, [,scope:String]) : Object

HTTP

 http://www.example.com:1111/admin/setConfig?auser=username&apswd=password&key=string&value=string [&scope=scope]

This API has been deprecated; use setConfig2() instead. Changes the value of the specified configuration key in a specified configuration file. For a description of the XML configuration files, see Adobe Media Server Configuration and Administration Guide.

Virtual host administrators can change the values of configuration keys in the Vhost.xml file and Application.xml files for their own virtual hosts. You must be a server administrator to change the values of most configuration keys in the Server.xml and Adaptor.xml files.

Note:

It is possible to have more than one XML tag with the same name at the same level in the XML tree. In the configuration file, you should distinguish such tags by using a name attribute in the XML tag (for example, if you have more than one virtual host: <VirtualHost name="www.redpin.com"></VirtualHost>.) When you call the setConfig() method and specify the configuration subkeys, you can indicate which tag you want by specifying the tag name, followed by a colon and the correct name attribute, for example: Adaptor:_defaultRoot_/VirtualHost:www.redpin.com.

Availability

Flash Communication Server 1.0.

Parameters

key

A String indicating the configuration key for which you want to change the value.

A key is specified as a list of subkeys delimited by slashes (/). The first subkey specifies the XML configuration file that contains the desired configuration key. Subsequent subkeys correspond to tags that are relative to that XML configuration file; the hierarchy and names of the subkeys match the tags in the XML file.

Depending on your permissions, you can change the values of configuration keys for the following files:

  • For the Server.xml file, specify Admin or Server as the first subkey. All subsequent keys correspond to tags that are relative to the <Admin> or <Server> tag in the Server.xml file.

    You must be a server administrator to set configuration keys in the <Server> tag.

    Virtual host administrators can set configuration keys for their own virtual host only. They might not be able to set certain kinds of sensitive information; for example, they can set their own password, but they cannot set other virtual host administrators’ passwords or permission settings.

  • For the Adaptor.xml file, specify as the first subkey Adaptor:adaptor_name, where adaptor_name is the name of the adaptor. All subsequent keys correspond to tags relative to the <Adaptor> tag in the Adaptor.xml file.

  • For the Vhost.xml file, specify as the first subkey Adaptor:adaptor_name/VirtualHost:vhost_name, where vhost_name is the name of the virtual host. All subsequent keys correspond to tags relative to the <VirtualHost> tag in the Vhost.xml file.

  • For the Application.xml file of an application that is running on the same virtual host to which you connected when you logged on to the administration server, specify as the first subkey Application:app_name, where app_name is the name of the application.

    To get a key in the Application.xml file for an application that is running on a different virtual host, specify the full key: Adaptor:adaptor_name/VirtualHost:vhost_name/Application:app_name. You must also specify the scope parameter; see the code example later in this entry.

    To get the default Application.xml file, specify Application without the colon (:) and the app_name attribute.

Note: If a subkey is specified but a corresponding tag doesn’t exist in the XML file, a new tag is created in the XML file.

value

A String indicating the value to set for the specified configuration key.

scope

A String; to change a configuration key in the Server.xml file, Adaptor.xml file, or Vhost.xml files, you must specify a slash (/) for this parameter.

To change a configuration key in the Application.xml file for an application that is running on the same virtual host to which you connected when you logged on to Adobe Media Server, omit this parameter.

Note: To determine the adaptor or virtual host to which you’re connected, use the getAdminContext() method.

auser

A String indicating the user name of the administrator.

apswd

A String indicating the password of the administrator.

Returns

RTMP/E

If the call succeeds, the server sends a reply information object with a level property of status and a code property of NetConnection.Call.Success. The value of the configuration key is changed.

If the call fails, the server sends a reply information object with a level property of error, a code property of NetConnection.Call.BadValue, and a description property that contains a string describing the cause of the failure.

This call fails if the specified configuration key cannot be found or if you do not have permission to change its value.

HTTP

If the call succeeds, it returns XML with the following structure:

 <result>   <level></level>   <code></code>   <timestamp></timestamp>  </result>

If the call fails, it returns XML with the following structure:

 <result>   <level></level>   <code></code>   <description></description>   <timestamp></timestamp>  </result>

The XML elements contain the same information as the Object properties returned in an RTMP/E call.

Note: The timestamp response over HTTP is formatted differently on Windows (9/23/2007 6:16:40 PM) and Linux (Sun 23 Sep 2007 06:16:40 PM IST).

Examples

The following examples show how to set new values for configuration keys in each of the four XML files:

 // Establish connection to server 
 nc_admin = new NetConnection(); 
 nc_admin.connect("rtmp://localhost:1111/admin", "LGreen", "123jn098"); 
  
 // For a virtual host administrator, change key in Server.xml 
 // Set Password for user LGreen to "strawman28" 
 key = "Admin/Server/UserList/User:LGreen/Password"; 
 val = "strawman28" 
 nc_admin.call("setConfig", new onSetConfig(), key, val, "/"); 
  
 // For a server administrator, change key in Server.xml 
 // Set LicenseInfo to "Helloworld" 
 key = "Server/LicenseInfo"; 
 val = "Helloworld"; 
 nc_admin.call("setConfig", new onSetConfig(), key, val, "/"); 
  
 // Change key in Adaptor.xml 
 // Set HostPort to 128.0.0.1:1938 
 key = "Adaptor:_defaultRoot_/HostPortList/HostPort"; 
 val = "128.0.0.1:1938"; 
 nc_admin.call("setConfig", new onSetConfig(), key, val, "/"); 
  
 // Change key in Vhost.xml 
 // Set RecordAccessLog to true 
 key = "Adaptor:_defaultRoot_/VirtualHost:_defaultVHost_/RecordAccessLog"; 
 val = "true"; 
 nc_admin.call("setConfig", new onSetConfig(), key, val, "/"); 
  
 // Change key in Application.xml for an application on the virtual host  
 // you connected to when you logged on to the administration server. 
 // Note that the previous subkeys and the final parameter "/" are not 
 // necessary. 
 key = "Application:FinanceApp/RecordAppLog"; 
 val = "true"; 
 nc_admin.call("setConfig", new onSetConfig(), key, val); 
  
 // Change key in Application.xml for a different virtual host. 
 // The adaptor and virtual host names and the second parameter are necessary. 
 key = "Adaptor:_defaultRoot_/VirtualHost:www.redpin.com/Application:ChatApp/ ¬ RecordAppLog"; 
 val = "true"; 
 nc_admin.call("setConfig', new onSetConfig(), key, val, "/");

See also

Get help faster and easier

New user?