def _apply(self, ctx: ExtensionContext) -> AugmentedDict:
        """
        Replaces any {{var::*}} directives with it's actual variable value or a default.

        Args:
            ctx: The processing context.

        Returns:
            Returns the altered node key and value.
        """
        node_key, node_value = ctx.node

        def process(pattern: Pattern[str], _str: str) -> Any:
            _match = pattern.match(_str)
            if _match is None:
                return _str
            # We got a match
            # Group 0: Whole match; Group 1: Our placeholder; Group 2: The environment variable
            placeholder, varname = _match.group(1), _match.group(2)
            varval = self.vars.get(varname, None)
            if varval is None and self.fail_on_unset:
                raise ExtensionError("Variable '{}' is unset.".format(varname))

            return _str.replace(placeholder, varval or self.default)

        _pattern = re.compile(self.__pattern__)
        node_key = process(_pattern, node_key)
        node_value = process(_pattern, node_value)

        return {node_key: node_value}