Documentation
¶
Index ¶
- Variables
- func LoadAppConf(ctx context.Context, appDir, name string, logger *log.Logger) (*apps.Config, error)
- func LoadEmbeddedConf(ctx context.Context, moduleDir, version string, logger *log.Logger) (*modules.Config, error)
- func LoadEmbeddedDefinition(moduleDir string) (*dto.ModuleDefinition, error)
- func LoadGlobalConf(ctx context.Context, logger *log.Logger) (*global.Config, error)
- func LoadModuleConf(ctx context.Context, moduleDir, name string, logger *log.Logger) (*modules.Config, error)
- type RawSchemas
Constants ¶
This section is empty.
Variables ¶
var ( // ErrFileWrongExtension is returned when a file has an unexpected extension for a batch hook ErrFileWrongExtension = errors.New("file has wrong extension") // ErrFileNotExecutable is returned when a hook file lacks executable permissions ErrFileNotExecutable = errors.New("no executable permissions, chmod +x is required to run this hook") )
var ErrPackageNotFound = errors.New("package not found")
ErrPackageNotFound is returned when the requested package directory doesn't exist
Functions ¶
func LoadAppConf ¶
func LoadAppConf(ctx context.Context, appDir, name string, logger *log.Logger) (*apps.Config, error)
LoadNamedAppConf loads the application appName ("namespace.name", e.g. "default.my-app") at version from appDir.
Steps:
- Validates the package directory exists
- Loads the package definition (package.yaml)
- Loads values (static values.yaml and OpenAPI schemas)
- Extracts namespace and name from the directory basename
- Discovers and loads batch hooks
- Loads image digests (images_digests.json)
- Loads settings conversions (openapi/conversions)
Returns ErrPackageNotFound if the directory doesn't exist.
func LoadEmbeddedConf ¶ added in v1.76.0
func LoadEmbeddedConf(ctx context.Context, moduleDir, version string, logger *log.Logger) (*modules.Config, error)
LoadEmbeddedConf loads a module config from an embedded (built-in) module directory. Unlike LoadModuleConf, it does not resolve version by symlinks.
func LoadEmbeddedDefinition ¶ added in v1.78.0
func LoadEmbeddedDefinition(moduleDir string) (*dto.ModuleDefinition, error)
LoadEmbeddedDefinition loads the package definition of an embedded module (package.yaml with a module.yaml fallback), without the hooks, values and schemas LoadEmbeddedConf brings. The path may name the module directly or carry the on-disk weight prefix.
func LoadGlobalConf ¶ added in v1.76.0
LoadGlobalConf loads the global module configuration from the globalPath directory. Unlike app and module loading, global hooks come from the compiled-in Go SDK registry, not from the filesystem. Only values and OpenAPI schemas are read from disk.
Returns ErrPackageNotFound if the global-hooks directory doesn't exist.
func LoadModuleConf ¶
func LoadModuleConf(ctx context.Context, moduleDir, name string, logger *log.Logger) (*modules.Config, error)
LoadModuleConf loads the downloaded module name at version from moduleDir.
Steps:
- Validates the module directory exists
- Loads the package definition (package.yaml, falling back to module.yaml)
- Loads values (static values.yaml and OpenAPI schemas)
- Discovers and loads batch hooks
- Loads image digests (images_digests.json)
Returns ErrPackageNotFound if the directory doesn't exist.
Types ¶
type RawSchemas ¶ added in v1.78.0
type RawSchemas struct {
// Settings is openapi/settings.yaml (or the legacy openapi/config-values.yaml); nil when absent.
Settings []byte
// Values is openapi/values.yaml; nil when absent.
Values []byte
// Conversions are the openapi/conversions/v<N>.yaml or v<N>.yml files; nil when absent.
Conversions [][]byte
}
RawSchemas are the raw schema files of a package as disk holds them.
func LoadEmbeddedSchemas ¶ added in v1.78.0
func LoadEmbeddedSchemas(moduleDir string) (RawSchemas, error)
LoadEmbeddedSchemas reads the raw schemas and settings conversions of an embedded module, without the rest of the config LoadEmbeddedConf brings. A module without the files yields nils. The path may name the module directly or carry the on-disk weight prefix.
func LoadGlobalSchemas ¶ added in v1.78.0
func LoadGlobalSchemas(globalHooksDir string) (RawSchemas, error)
LoadGlobalSchemas reads the raw schemas and settings conversions of the global module from the given global hooks dir. Unlike LoadEmbeddedSchemas it resolves no weight prefix: the global dir carries none, and it holds no definition file either, so the schemas are all a reader gets. A dir without them yields nils.