settings

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package settings is a platform module: business settings of the project, stored in the database and editable without a deploy.

The schema is generated from settings.yaml and comes from project code; the module adds storage, caching, refresh and the store in the container.

Index

Constants

View Source
const DefaultTable = "platform_settings"

DefaultTable is where overrides are stored.

Variables

This section is empty.

Functions

func Store

func Store(app *platform.App) *settingsx.Store

Store returns the store from the container.

Types

type Config

type Config struct {
	Table string // table holding the overrides

	// RefreshInterval is how often values are re-read, so a change made on one instance
	// reaches the others. Zero disables the refresh loop.
	RefreshInterval time.Duration
}

Config holds module settings. Load fills it from the environment; the platform generator writes the Load call into the project's config.gen.go.

func Load

func Load(l *confx.Loader) Config

Load reads the module settings from environment variables.

type Module

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

Module implements platform.Module.

func New

func New(cfg Config, schema settingsx.Schema) *Module

New creates the module from ready settings and the project schema.

func (*Module) Health

func (m *Module) Health(context.Context) error

Health fails when the settings cannot be re-read: the application still works on the cached values, yet a change would not reach it, and that must be visible.

func (*Module) Init

func (m *Module) Init(ctx context.Context, app *platform.App) error

Init creates the table, loads the values and puts the store into the container, where project code picks it up through the generated accessors.

func (*Module) Name

func (m *Module) Name() string

func (*Module) Start

func (m *Module) Start(ctx context.Context) error

Start begins the refresh loop: a value changed on one instance takes effect on the others within RefreshInterval, with no restart and no deploy.

func (*Module) Stop

func (m *Module) Stop(context.Context) error

Stop ends the refresh loop.

Jump to

Keyboard shortcuts

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