config

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package config loads and validates the Sforza service configuration.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth

type Auth struct {
	Enabled    *bool  `yaml:"enabled"`
	Issuer     string `yaml:"issuer"`
	Audience   string `yaml:"audience"`
	DefaultSub string `yaml:"default-sub"`
}

Auth holds OIDC authentication settings. Enabled defaults to true so that security is opt-out, never accidentally off.

func (Auth) IsEnabled

func (a Auth) IsEnabled() bool

IsEnabled reports whether authentication is enabled (default true).

type Bootstrap

type Bootstrap struct {
	AdminSub string   `yaml:"admin-sub"`
	Files    []string `yaml:"files"`
}

Bootstrap holds startup synchronization settings.

type Config

type Config struct {
	Server    Server    `yaml:"server"`
	Auth      Auth      `yaml:"auth"`
	Bootstrap Bootstrap `yaml:"bootstrap"`
	Storage   Storage   `yaml:"storage"`
}

Config is the root service configuration.

func Load

func Load(path string) (*Config, error)

Load reads, env-expands, parses and validates the configuration file at path. Environment variables are expanded with ${VAR} / $VAR syntax, which is how Docker deployments inject secrets.

func Parse

func Parse(doc string) (*Config, error)

Parse parses and validates a YAML configuration document.

type DB

type DB struct {
	Driver string `yaml:"driver"`
	DSN    string `yaml:"dsn"`
}

DB is a single database connection definition.

type Server

type Server struct {
	Address string `yaml:"address"`
}

Server holds HTTP server settings.

type Storage

type Storage struct {
	Shared  DB            `yaml:"shared"`
	Tenants map[string]DB `yaml:"tenants"`
}

Storage declares the shared database and one database per tenant. The keys of Tenants are the full set of tenant IDs the service accepts.

Jump to

Keyboard shortcuts

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