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 ¶
- type Environment
- type FileWatcher
- type State
- func (s *State) GetEnvNames() []string
- func (s *State) GetMaster(env string) *dynamic.Configuration
- func (s *State) LoadLocalFile(ctx context.Context, env, path string) error
- func (s *State) Subscribe(env string) chan *dynamic.Configuration
- func (s *State) Unsubscribe(env string, ch chan *dynamic.Configuration)
- func (s *State) UpdateAgent(env, name string, data []byte)
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 (*State) GetEnvNames ¶
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 ¶
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 ¶
UpdateAgent replaces an agent's config and rebuilds the merged master.