Source Resolver
The source resolver module contains all interfaces to implement a custom source resolver, that is used when a configuration contains @include meta-commands.
This implementation also provides a default implementation for a source resolver in the module file_source_resolver. This desfault implementation is used by default, but you can customize it by creating you own instance.
Interface
- class SourceResolverContext(include_text: str, source: SourceIdentifier)
 Context information for resolving an included source.
- Variables:
 include_text – The text from the include directive.
source – Identifier of the source that contains the
@includemeta-command.
- class SourceResolver
 Abstract interface for resolving include directives.
- abstractmethod resolve(context: SourceResolverContext) list[Source]
 Resolve the sources referenced by an include directive.
- Parameters:
 context – The context that describes the files to include.
- Returns:
 A list of resolved
erbsland.conf.Sourceobjects.
Resolver for file: include directives.
- class ResolverFeature(*values)
 Features supported by the file source resolver.
- RECURSIVE_WILDCARD = 1
 Support the recursive wildcard
**in the directory part of a path. If this feature is disabled, recursive wildcards are rejected.
- FILENAME_WILDCARD = 2
 Support the filename wildcard
*. If this feature is disabled, wildcards in the filename are rejected.
- ABSOLUTE_PATHS = 4
 Support absolute include paths. If this feature is disabled, absolute paths are rejected.
- WINDOWS_UNC_PATH = 8
 Support Windows UNC paths. If this feature is disabled, UNC paths are rejected.
- FILE_PROTOCOL = 16
 Support the
file:protocol prefix. If this feature is disabled, paths containing a protocol prefix are rejected.
- ALL = 31
 All features.
- class FileSourceResolver(features: ~erbsland.conf.file_source_resolver.ResolverFeature = <ResolverFeature.ALL: 31>)
 Resolve
@includestatements referencing local files.The resolver supports relative and absolute paths and provides optional wildcard support.
Examples:
@include: "file:example.elcl" # File in the same directory @include: "file:sub/example.elcl" # File in a subdirectory @include: "file:/usr/local/example.elcl" # Absolute path
- resolve(context: SourceResolverContext) list[Source]
 Resolve the include path from context.
- Parameters:
 context – Resolution context containing the include text and source.
- Returns:
 A list of resolved file sources.
- Raises:
 ConfSyntaxError – If the include text is invalid.
ConfLimitExceeded – If the include matches more documents than allowed.