configuration

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 16, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package configuration is the configuration module's constructor: New(Deps) binds configuration/api over the descriptor core, which applies system configuration and descriptors across the other modules through their api packages.

Role

configuration module, module root. Only app imports a module root; other modules reach configuration through configuration/api (decision 0044, dependency rules).

Inputs

Deps, which app passes New:

  • Store, required: the unit of work a descriptor is applied in and the configuration documents. App passes its composite store, which satisfies it.
  • Repositories and Layouts, from the artifacts module's API, and Access, the access module's API, whose AnonymousAccess the security section writes. All of them are bound over the same store, so a descriptor's writes commit or roll back together.
  • Settings, the configuration options from app/config's Configuration (docker.subdomain_match).
  • Log, for the services the module builds itself; it builds none yet, so New does not read it.

Outputs

  • Module, whose API returns configuration/api's Descriptor (parse and apply a descriptor: PATCH /api/system/configuration, config apply and the bootstrap descriptor) and System (the descriptor's settings that other modules read), and whose Settings returns the Settings from Deps.
  • Store, what the module needs of the metadata store.

Invariants

  • New does no I/O and calls nothing on the store: the configuration documents are reached on each call, so app can build the module before anything is read. It refuses only Deps without a store.
  • The bindings return the descriptor core's and the store's errors as they gave them, so every text an apply answers stays byte-identical.

References

  • Context map, configuration row, as https://github.com/weaveplatform/artifactweave/issues/958 records it: owns system configuration, descriptors, import and export, and backups; phases P12 and P36.
  • Target layout: docs/research/architecture-options/5-modular-monolith.md, "Full package tree", lines 302-315, and "Composition root", lines 746-804.
  • Decision 0044: docs/research/decisions/0044-modular-monolith-migration.md, "Placeholders", "Composition and HTTP" and "Names the migration introduces".
  • Decision 0009: docs/research/decisions/0009-configuration-as-code.md.
  • Plan: docs/implementation/plan.md#p9d-modular-monolith-migration, #p12-descriptor-export-system-configuration-ldap, #p36-migration-backup-and-recovery.
  • https://github.com/weaveplatform/artifactweave/issues/1094

Status

Implemented P9d: New and Module, the module constructor over the descriptor binding. The module's routes stay in the server for now, and config apply and the bootstrap descriptor bind the descriptor core over the store alone, before any module exists.

Testing

  • TestUnitNew: a store is required, New calls none of its methods, and the API and Settings are bound.
  • TestUnitConfigsReachTheStore: the configuration documents the binding reads and writes are the store's, with its errors.
  • The descriptor's behaviour is tested in configuration/core/descriptor and configuration/adapters/http.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Deps

type Deps struct {
	// Store is required.
	Store Store
	// Repositories reads, checks and writes the repositories of the four
	// repository sections; the artifacts module's API binds it over the same
	// store.
	Repositories artifactsapi.Repositories
	// Layouts checks each repoLayouts entry before it is stored.
	Layouts artifactsapi.Layouts
	// Access is the access module's API, through whose AnonymousAccess the
	// descriptor writes the security section's anonymous access switch.
	Access accessapi.API
	// Settings are the configuration options of the module's code, from
	// app/config's Configuration, which Settings returns.
	Settings configapi.Settings
	// Log receives the logs of the services the module builds itself; nil
	// means slog.Default(). New builds none, and the descriptor binding logs
	// nothing, so New does not read it.
	Log *slog.Logger
}

Deps is what app passes New: the store and the other modules' contracts that a descriptor is applied through, and the module's settings.

type Module

type Module struct {
	// contains filtered or unexported fields
}

Module is the configuration module as app holds it. It is safe for concurrent use: it holds only its bindings and settings.

func New

func New(d Deps) (*Module, error)

New binds configuration/api's Descriptor and System over d with the descriptor core. It does no I/O, and calls nothing on the store until a method of the API is called; it refuses only Deps without a store.

func (*Module) API

func (m *Module) API() configapi.API

API returns the module's published surface: the Descriptor that parses and applies configuration descriptors, and the System that other modules read the descriptor's settings through.

func (*Module) Settings

func (m *Module) Settings() configapi.Settings

Settings returns the Settings from Deps.

type Store

type Store interface {
	tx.Runner
	Configs() configdoc.ConfigStore
}

Store is what the module applies descriptors through on the metadata store: the unit of work Apply writes in, and the configuration documents (the proxies, property sets, layouts and the downloadRedirectConfig section). Each composite store in app satisfies it. Every call joins the transaction ctx carries.

Directories

Path Synopsis
adapters
http
Package configurationhttp is the configuration module's HTTP adapter: the artifactory spec's system operations (version, license, service id, readiness, liveness and the reverse proxy configuration), the probes and telemetry sinks the router mounts beside them, and the YAML descriptor PATCH.
Package configurationhttp is the configuration module's HTTP adapter: the artifactory spec's system operations (version, license, service id, readiness, liveness and the reverse proxy configuration), the probes and telemetry sinks the router mounts beside them, and the YAML descriptor PATCH.
Package api is the configuration module's published surface: the configuration descriptor's parse and apply behind an opaque plan, the system value that other modules read, and the configuration settings.
Package api is the configuration module's published surface: the configuration descriptor's parse and apply behind an opaque plan, the system value that other modules read, and the configuration settings.
core
backup
Package backup will run scheduled backups.
Package backup will run scheduled backups.
descriptor
Package descriptor reads Artifactory's YAML configuration descriptor and applies it (decision 0009): the body of PATCH /api/system/configuration, `artifactweave config apply` and the bootstrap descriptor.
Package descriptor reads Artifactory's YAML configuration descriptor and applies it (decision 0009): the body of PATCH /api/system/configuration, `artifactweave config apply` and the bootstrap descriptor.
system
Package system will hold the system configuration: base URL, web server, mail server, proxies and the system message.
Package system will hold the system configuration: base URL, web server, mail server, proxies and the system message.
transfer
Package transfer will import and export Artifactory data and run the bootstrap migration.
Package transfer will import and export Artifactory data and run the bootstrap migration.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL