/  Yamcs Server Manual  /  Configuration Sections

Configuration SectionsΒΆ

Some of the standard configuration files can be extended with custom configuration options. This is called a configuration section. Sections are represented by a top-level identifier and are scoped to a type of configuration file.

A Yamcs plugin is automatically associated with a configuration section named after the plugin identifier.

For example, the yamcs-web module is packaged as a Yamcs plugin, and accepts configuration options read from the yamcs-web section of the main etc/yamcs.yaml:

public class WebPlugin implements Plugin {

    public Spec getSpec() {
        Spec spec = new Spec();
        // ...
        return spec;
    }

    @Override
    public void onLoad(YConfiguration config) throws PluginException {
        // Use the actual configuration
    }
}

Here the org.yamcs.Spec object is a helper class that allows defining how to validate your plugin configuration. Yamcs will take care of the actual validation step, and if all went well the onLoad hook should trigger. This is a good place to access the runtime configuration model, and retrieve your custom options.

If you have custom components that want to access this configuration, one possible way is to provide accessors on your plugin class, and then to retrieve the singleton instance of your plugin class:

PluginManager pluginManager = YamcsServer.getServer().getPluginManager();
MyPlugin plugin = pluginManager.getPlugin(MyPlugin.class);
// ...

Instance-specific configuration

Besides global plugin configuration options in etc/yamcs.yaml, you may also want to add instance-specific configuration options. These would be considered when validating any etc/yamcs.instance.yaml file:

YamcsServer yamcs = YamcsServer.getServer();
yamcs.addConfigurationSection(ConfigScope.YAMCS_INSTANCE, "my-section", spec);