1.8. Configuration Files

The DataHub program uses multiple configuration files. When the program is first started it creates its primary configuration file, Cogent DataHub.cfg, along with other .cfg files that correspond to various DataHub plug-ins. These files get edited automatically when you make changes to features in the Properties window. When you shut down and restart a DataHub instance, it reads and uses the last saved configuration from each file.

There are two syntaxes used in DataHub configuration files. DataHub Command syntax is used in some, and XML syntax is used in others, depending on the complexity of the corresponding plug-in, and its implementation. Occasionally an experienced user might have reason to edit a configuration file directly, but in general modifications should be made through the Properties window.

DataHub configuration files are stored as UTF-8 text, without a byte-order marker (BOM). If you do choose to edit a DataHub configuration file, ensure that your text editor is storing the file in this format. The presence of BOM characters will cause the configuration file to fail. Also, if you choose to edit a DataHub configuration file, whether by hand or through a text generation program, it is good practice to stop the DataHub program before modifying the file.

Configuration and License Files Location

The DataHub program stores its configuration and license (licenses.lic) files in the current user's directory, in a subdirectory named Cogent DataHub. You can find its configuration path in the DataHub About panel, by clicking the About button in the DataHub Properties window.

Here are the typical locations:

[Note]

If you ever need to back up or move the DataHub configuration, please refer to Section 1.9, “Backing Up or Moving a DataHub Installation”.

[Note]

The Application Data or AppData directory might be a hidden directory.

If there is no private configuration when a DataHub instance starts, it will search for configuration files and license files from previous versions in the application installation directory, and copy them to the user's private configuration. If there are no old configuration files, the DataHub instance will copy all the current configuration files from the application installation directory. Thereafter, changes to the DataHub program's properties (made through the Properties window) will only change the user's private configuration.

You can modify this behaviour in two ways with the following command line options:

  1. Provide the -H home option which will indicate to DataHub program that it should store the private configuration and license files in the directory specified by home, rather than in a subdirectory of Application Data. The DataHub program will still search for previous and default configuration files and licenses in the application installation directory as described above.

  2. Provide the -U option which will indicate to the DataHub program that it should not create private configuration files for each user, but store its configuration in the application installation directory.

If both -H and -U are specified, the -U flag is ignored.

You can also set the configuration folder globally using the DataHub Service Manager, even if the DataHub software is not installed as a Windows service. Here's how:

  1. Open the DataHub Service Manager.

  2. Click the button Set Global Configuration Folder.

  3. Type or browse to the folder you want to use for configuration, and click OK.

  4. Close the DataHub Service Manager window.

  5. Start a DataHub instance normally.

This should result in a DataHub instance using the specified folder as its configuration folder whenever it is started without the -H option.

Custom Configuration Files

When the DataHub program starts up, you may wish to have certain points and data structures get created immediately. To do this, you can create one or more custom configuration files. These files must be listed in the bottom of the Scripting option of the Properties Window.

[Important]

Creating and editing custom configuration files should only be attempted by experienced users. If you do create a custom configuration file, we strongly recommend that it only be used for creating points and data structures, and not for standard configuration commands, such as those that are created and modified through entries in the Properties window. Doing otherwise could result in irregular behavior in the DataHub program.

The following sets of commands are the only ones that should be used in a custom configuration file:

General commands allowed in config files

create mult
set div
cset lock
write quality
cwrite secure
force append
cforce dump
add include

Model-related commands allowed in config files

alias private_attribute
assembly property
attribute subassembly
defaultprop type
instance

Only allowed in Windows config files

execute_plugin show_debug_messages
load_plugin show_event_log
unload_plugin show_icon
load_scripts show_properties
show_data show_script_log

Custom configuration files can be created using a text editor like Notepad, and are written in Lisp syntax. They should be put in the same directory as the Cogent DataHub executable, such as C:\Program Files (x86)\Cogent\Cogent DataHub\ (it may be different for your installation). Each entry of the file contains either a command or a comment. Comments are marked with a semicolon character (;) at the beginning of each line.

For more information about commands and their syntax, please refer to Cogent DataHub Command Set.

A small custom configuration file might look like this:

;;; Create some points in the default data domain and assign values.
(cset default:Point1 5)
(cset default:Point2 67.234)
(cset default:Point3 Hello)

;;; Create a new data domain
(create_domain NewDomain)

;;; Create some points in the new data domain and assign values.
(cset NewDomain:Point1 "A string")
(cset NewDomain:Point2 95)
(cset NewDomain:Point3 3.1519)