state

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package state contains the traefik configuration by environment

Package state manages traefik dynamic configurations per environment, merging local files and agent submissions into a single master config.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Environment

type Environment struct {
	Master *dynamic.Configuration
	Agents map[string]*dynamic.Configuration
	Local  *dynamic.Configuration
}

type FileWatcher added in v0.1.5

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

FileWatcher tracks a single config file for live reloads.

type State

type State struct {
	Envs map[string]*Environment
	// contains filtered or unexported fields
}

State holds traefik configurations grouped by environment.

func New

func New() *State

func (*State) GetEnvNames

func (s *State) GetEnvNames() []string

GetEnvNames returns all registered environment names.

func (*State) GetMaster

func (s *State) GetMaster(env string) *dynamic.Configuration

GetMaster returns the merged configuration for the given environment.

func (*State) LoadLocalFile

func (s *State) LoadLocalFile(ctx context.Context, env, path string) error

LoadLocalFile reads a config file, stores it, and watches for live changes.

func (*State) Subscribe

func (s *State) Subscribe(env string) chan *dynamic.Configuration

Subscribe returns a channel that receives config updates for the environment.

func (*State) Unsubscribe

func (s *State) Unsubscribe(env string, ch chan *dynamic.Configuration)

Unsubscribe removes and closes a subscription channel.

func (*State) UpdateAgent

func (s *State) UpdateAgent(env, name string, data []byte)

UpdateAgent replaces an agent's config and rebuilds the merged master.

Jump to

Keyboard shortcuts

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