watcher

package
v6.1.3 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2025 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package watcher provides file system monitoring functionality for the CLI Proxy API. It watches configuration files and authentication directories for changes, automatically reloading clients and configuration when files are modified. The package handles cross-platform file system events and supports hot-reloading.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildAPIKeyClients

func BuildAPIKeyClients(cfg *config.Config) (int, int, int, int)

Types

type AuthUpdate

type AuthUpdate struct {
	Action AuthUpdateAction
	ID     string
	Auth   *coreauth.Auth
}

AuthUpdate describes an incremental change to auth configuration.

type AuthUpdateAction

type AuthUpdateAction string

AuthUpdateAction represents the type of change detected in auth sources.

const (
	AuthUpdateActionAdd    AuthUpdateAction = "add"
	AuthUpdateActionModify AuthUpdateAction = "modify"
	AuthUpdateActionDelete AuthUpdateAction = "delete"
)

type Watcher

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

Watcher manages file watching for configuration and authentication files

func NewWatcher

func NewWatcher(configPath, authDir string, reloadCallback func(*config.Config)) (*Watcher, error)

NewWatcher creates a new file watcher instance

func (*Watcher) SetAuthUpdateQueue

func (w *Watcher) SetAuthUpdateQueue(queue chan<- AuthUpdate)

SetAuthUpdateQueue sets the queue used to emit auth updates.

func (*Watcher) SetConfig

func (w *Watcher) SetConfig(cfg *config.Config)

SetConfig updates the current configuration

func (*Watcher) SnapshotCoreAuths

func (w *Watcher) SnapshotCoreAuths() []*coreauth.Auth

SnapshotCoreAuths converts current clients snapshot into core auth entries.

func (*Watcher) Start

func (w *Watcher) Start(ctx context.Context) error

Start begins watching the configuration file and authentication directory

func (*Watcher) Stop

func (w *Watcher) Stop() error

Stop stops the file watcher

Jump to

Keyboard shortcuts

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