Configuration

The tdsync command-line utility requires a number of settings to function correctly. These values can be specified via a configuration file or via command-line parameter.

Required Parameters

At a minimum, tdsync requires the following settings.

url
The base URL of the Titania Delivery Admin web application (a path ending in /admin/).
username
The login name (e-mail address) to use when authenticating with the Administrative application.
password
The password for the account identified by username.
projectKey
The identifier for the project to sync with. When viewing a project in the Titania Delivery Administrative UI, the project key is the segment of the URL immediately following /projects/.

Specifying Configuration Values

These settings can be specified two ways.

  • They can be specified on the tdsync command-line as parameters. For example:
    tdsync --url https://td.example.com/admin --username demo@example.com \
        --password MyP4ssword --projectKey 970d10c6e4b0ef3ae42407a4
  • They can be specified in a configuration file called .tdsyncrc at the root of the folder to sync. This file follows Java Properties File syntax rules. For example:
    url=https\://td.example.com/admin
    username=demo@example.com
    password=MyP4ssword
    projectKey=970d10c6e4b0ef3ae42407a4

When parameters are passed using both the command line and a .tdsyncrc file, the command-line value takes precedence. This means that you can always override the settings in .tdsyncrc using the command-line. The final, runtime configuration is the combination of the following, in order of precedence:

  1. Command-line parameters.
  2. Settings in the current directory's .tdsyncrc file, if any.
  3. Settings in parent directories' .tdsyncrc files, if present; see below.
  4. Settings in the .tdsyncrc file in the current user's home directory, if present.

Hierarchical Configuration

In addition to the .tdsyncrc file in the directory to sync, the tdsync will look for .tdsyncrc files in its ancestor folders, as well as the current user's home directory. Settings "closer" to the sync root will take precedence over those at higher levels, with the settings in the user's home directory taking the lowest precedence.

This means that if a set of sibling folders shares certain configuration settings, you could place those settings in a .tdsyncrc file at a higher level, and specify only the differences in the sync roots. A user could specify the url, username, and password in their home directory, leaving only projectKey to be specified in folders to be synced.

Optional Settings

In addition to the four required parameters, there are a number of optional configuration settings.

projectFolder
The folder path within the project to sync to. If omitted or set to /, the folder will be synced to the root of the project.
missingFiles
This parameter specifies the sync behavior when a file is present on the server but missing locally. The legal values are as follows.
ignore
Such files will be ignored for purposes of sync. This is the default behavior.
download
Such files will be downloaded from the server and added to the local directory during sync.
delete
Such files will be deleted from the server during sync.
excludes.n
Parameters beginning with excludes., followed by a number, will be treated as file patterns to exclude from sync. The value for this parameter is an Apache Ant-style match pattern.
Note: Exclusion pattern numbers must start at 1 and be contiguous. If a configuration includes excludes.1, excludes.2, and excludes.4, the last will be ignored because excludes.3 is not present.
metadataLoader
The mode for loading metadata associated with the files in the folder. See Setting Metadata for details.
metadataLoader.param
Parameters for the metadata loader are set using keys prefixed with metadataLoader. See Setting Metadata for details.
metadataBehavior
The behavior when syncing metadata with the server. Possible values:
replace
Local metadata from the metadataLoader will fully replace any metadata on the server.
merge
Metadata loaded from the metadataLoader will be merged with what already exists on the server.
skip
The metadataLoader will not be used.
missingMetadata
Specifies behavior for excess metadata keys on an item. Possible values:
delete (default)
Delete metadata keys that are not in the current supplied metadata.
ignore
Excess metadata keys will be ignored.

Sample Full Configuration

# This file contains Titania Delivery sync configuration options.

# Connection settings.
url=https\://td.example.com/admin
username=demo@example.com
password=MyP4ssword

# Project settings.
projectKey=12345
projectFolder=/path/to/folder
missingFiles=delete

# Exclusion patterns. Here we exclude all files and folders whose names
# begin with a period.
excludes.1=**/.*/

# Metadata loader settings.
# Use 'td' for JSON data in META-INF/metadata.json (present in downloaded
# archives). Use 'sdl' to pull metadata from SDL export side-files.
# In this example we're using a custom Metadata loader that requires a
# database URL (dbUrl) as a parameter.
metadataLoader=com.example.td.sync.DBMetadataLoader
metadataLoader.dbUrl=jdbc:mysql://db1:1234/tdmd
metadataBehavior=replace
missingMetadata=delete