Shared configuration files

Since spectrum uses an individual configuration file for each running instance, updating configuration details can be quite tedious: Updating some detail requires you to update every single configuration file manually. We do have some support for sharing the configuration files between all instances, but not without some drawbacks.

We already introduced configuration variables that enable you to only set the protocol and build the settings that use the same string using $protocol and $jid. If you name your configuration files appropriately, you can also use the filename to configure parts of the configuration: The file must either be named "<jid>:<protocol>:<port>.cfg" or "<protocol>:<port>.cfg". You can access these settings using these configuration variables:

  • $filename:jid (only available when using the first format)
  • $filename:protocol
  • $filename:port

Example

A configuration thats shared between all instances might look like this (irrelevant parts skipped):

...
protocol=$filename:protocol
port=$filename:port
...
jid=$protocol.example.com
config_interface=/var/run/spectrum/$protocol.sock
...

If you put this file in (e.g.) /etc/spectrum/shared-config and add icq:3333.cfg and msn:3334.cfg as symbolic links pointing to it, you will get two Spectrum instances:

  • icq.example.com serving ICQ using port 3333
  • msn.example.com serving MSN using port 3334

To add the symbolic links, use the ln command:

cd /etc/spectrum
ln -s shared-config icq.3333.cfg
ln -s shared-config msn.3334.cfg

Note: The name of the shared configuration file is arbitrary but should not end with '.cfg', otherwise it might be recognized as a configuration file on its own by some commands.

Drawbacks

  • Symbolic links are not supported on all platforms, especially not Windows.
  • When using symbolic links, some details like passwords have to be the same across every file.