pimsync.conf(5) File Formats Manual pimsync.conf(5)

pimsync.conf - pimsync configuration file

The pimsync configuration file is divided into three main types of sections:

global section

Global settings for pimsync.

storage sections

Configuration for individual storages.

pair sections

Rules for synchronising pairs of storages.

See the FILES section of pimsync(1) for details on the default path for the configuration file, and how to specify an alternative path.

The following setting can be set globally:

status_path

Path to a directory which will contain the status database internally used by pimsync.

Each storage section starts with a declaration of the storage name.

storage name { … }

Declare a storage with name name.

Each storage is defined by a block of directives, one per line, enclosed in curly braces:

type type

Type can be one of vdir/icalendar, vdir/vcard, caldav, carddav or webcal.

interval seconds

When monitoring a storage is no possible, check for changes every the specified amount of seconds. The default is 300 seconds.

Storages of type vdir take the following directives:

path path

Path to a directory storing a vdir. A leading tilde will be expanded to match the current user's home directory.

fileext ext

File extension for items saved into this vdir.

Storages of type caldav or carddav take the following directives:

url url
url { … }

URL of the Dav server. Service discovery will be performed on this URL to find the exact location of the home set collection. URLs must specify schema http, https or unix. URLs starting in unix:// will be treated as a path to a unix domain socket.

username username
username { … }

Optional. Username to use for HTTP Basic Auth.

password password
password { … }

Optional. Password to use for HTTP Basic Auth.

Storages of type webcal take the following directives:

url url
url { … }

URL of an icalendar file. This file may contain multiple calendar items. Scheme must be http or https.

collection_id name

Name to be used when mapping this collection to another on the other storage.

Storages of type caldav, carddav or webcal take the following directive:

user_agent user-agent

Optional. Set a custom User-Agent header on outgoing HTTP requests. The default uses pimsync/ followed by the current version number. E.g.: pimsync/1.0.0.

The url, username and password fields may be defined in the configuration file, or may specify a command to retrieve this value from an external store. To read a password via the external command secret-store --get-caldav-password, use the following syntax:

password {
	cmd secret-store --get-caldav-password
}

Each pair section starts with a declaration of the pair name.

pair name { … }

Declare a pair with name name.

Each pair is defined by a block of directives, one per line, enclosed in curly braces:

storage_a name

The name of the first storage to be synchronised with another.

storage_b name

The name of the second storage to be synchronised with the other.

collections all

Synchronise all collections found in both storages. Collections will be synchronised to others with a matching id on the other side. The is the recommended value if you simply want to synchronise all collections from both storages.

collections from a

Synchronise all collections found in storage_a. Each collection shall be synchronised with the collection which has the same collection id on storage_b.

collections from b

Synchronise all collections found in storage_b. Each collection shall be synchronised with the collection which has the same collection id on storage_a.

collection id

Synchronise collection with id id. May be specified more than once.

collection { … }

Synchronise collection defined by the given rules. See COLLECTION SECTIONS below. May be specified more than once.

on_empty skip

When a collection is entire empty on one side, skip it. This is the default.

on_empty sync

When a collection is entire empty on one side, empty its counterpart on the other side. Take great care when using this option. If you completely delete a collection on one side, pimsync(1) won't restore it. Instead, it will delete the same collection (and all of its items) on the other side.

The conflict_resolution directive specifies which action should be taken if an item was modified on both sides:

conflict_resolution cmd command [args]

Execute command to resolve conflicts between both sides. args will be passed as arguments, followed by the path to two files; one containing the data on storage a, and the other containing the data on storage b. The conflict will be considered resolved if and only if both files are the same when the command exits and the command exits with exit code zero.

conflict_resolution keep a

In case of conflict, keep the version for storage a.

conflict_resolution keep b

In case of conflict, keep the version for storage a.

A collections block defines a mapping between two collections that are to be synchronised; one of them in storage_a and the other in storage_b.

These sections are only used in advanced configurations which need to map existing collections to each other without changing their location on either side.

Each block must include an alias:

alias name

An alias for this pair of collections that will be used for any output.

Exactly one reference to a collection in storage_a must be included:

id_a id

Use a collection with id.

href_a href

Use a collection with href.

Exactly one reference to a collection in storage_b must be included:

id_b id

Use a collection with id.

href_b href

Use a collection with href.

For example, to syncrhonise a collection with id work with another at path /calendars/mine/work/, use:

collection {
	alias work
	id_a work
	href_b /calendars/mine/work/
}

Specifying an id and an href for the same storage is not allowed.

The id of a collection is a concept specific to pimsync(1) and vdirsyncer(1).

For vdir storages, the id of a collection is the name of the directory that corresponds to it.

For caldav or carddav storages, the id of a collection is the last component of its URL.

For webcal storages, the id must be specified explicitly via the collection_id configuration directive.

Unless configured otherwise, collections with the same id on both storages are synchronised with each other.

This example synchronises two storages with address books. The first is a local set of directories which contain vcard files, the second is a remote carddav servers. Credentials are supplied via the hiq command line tool.

status_path "~/.local/share/pimsync/status/"
pair contacts {
	storage_a contacts_local
	storage_b contacts_remote
	collections all
	conflict_resolution cmd nvim -d
}
storage contacts_local {
	type vdir/vcard
	path ~/.local/share/contacts/cards/
	fileext vcf
	interval 30
}
storage contacts_remote {
	type carddav
	url https://carddav.example.com/
	username hugo@example.com
	password {
		cmd hiq -dFpassword proto=carddavs username=hugo@example.com
	}
	interval 30
}

The following example synchronises two storages with calendar data. The first is local directories with icalendar files, the second is a remote caldav servers.

status_path "~/.local/share/pimsync/status/"
pair calendars {
	storage_a calendars_local
	storage_b calendars_remote
	collections from b
	conflict_resolution cmd nvim -d
}
storage calendars_local {
	type vdir/icalendar
	path ~/.local/share/calendars/
	fileext ics
	interval 30
}
storage calendars_remote {
	type caldav
	url https://caldav.example.com/
	username hugo@example.com
	password {
	 cmd hiq -dFpassword proto=caldavs username=hugo@example.com
	}
	interval 30
}

The following example synchronises two storages with calendar data. The first is a local directory named "italki" with icalendar files, the second is an http server publishing an icalendar file.

Note that the first storage is the same as the one above, and should be specified only once if both configurations were to be merged.

The exact URL to the icalendar file exposed via http is fetched via the hiq tool, used to query the himitsu secret store.

status_path "~/.local/share/pimsync/status/"
pair study_calendars {
	storage_a calendars_local
	storage_b calendars_italki
	collection italki
}
storage calendars_local {
	type vdir/icalendar
	path ~/.local/share/calendars/
	fileext ics
	interval 30
}
storage calendars_italki {
	type webcal
	collection_id italki
	url {
		cmd hiq -dFurl proto=webcal alias=italki-mine
	}
}

This example synchronises two storages with calendar data. The first is a carddav server, reached via a unix domain socket. The second is storage uses a local filesystem with vcard files.

status_path "~/.local/share/pimsync/status/"
pair unixtest {
	storage_a unix_a
	storage_b unix_b
	collections all
}
storage unix_a {
	type carddav
	url unix:///tmp/xandikos.sock
}
storage unix_b {
	type vdir/vcard
	path /tmp/test_storage/
	fileext vcf
}

pimsync(1), pimsync-migration(7)

The configuration file follows the scfg syntax.
See: https://git.sr.ht/~emersion/scfg

2024-12-16