Specification
*.addon.dk.yml
The file [addon-name].addon.dk.yml
that is the heart of the addon, is a special type of configuration
file. It means that everything that applies to the
configuration files, applies also to this file.
The location of this file indicates what the addon's main directory is.
Hooks
Addon can hook into the docker-compose.yml
generating process if you are using a recipe.
It means that some addons can modify your service definitions and the resulting docker-compose.yml
file.
To alter the services generated by the recipe addon has to provide the hooks.py
file that should
be placed in the same directory as its *.addon.dk.yml
file. In this file addon can declare the
function alter_service
that will run for each service that has this addon enabled in its definition.
Example:
def alter_service(name: str, service: dict, utils: object, addon: dict):
"""Alter the service.
Arguments:
name - Name of the service being altered.
service - Service definition. This dictionary should be altered.
utils - Instance of the HookUtils class.
addon - Content of the *.addon.dk.yml file of this addon.
"""
# Do something
HookUtils class.
This is a utility class that provides addons with some functionalities. It has the following methods available:
def substitute_variables(self, string: str) -> str
"""Substitute variables in the given string with their values.
"""