config

package
v2.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LogSourceConfigAllTrue = LogSourceConfig{
	LogConnectionStats: true,
	LogRequestHeaders:  true,
	LogRequest:         true,
	LogResponseHeaders: true,
	LogResponse:        true,
}

Functions

This section is empty.

Types

type AppMode

type AppMode int
const (
	ProxyRunMode AppMode = iota
	CacheMode
	APIAuditMode
)

type CacheStorageConfig

type CacheStorageConfig struct {
	ConfigVersion  string `json:"config_version"`  // The schema version of this cache index file.
	StorageEngine  string `json:"storage_engine"`  // The storage engine used for this cache
	StorageVersion string `json:"storage_version"` // The storage version used for this cache
	StoragePath    string `json:"storage_path"`    // The full path to the storage bucket (file path or database URI)
	// contains filtered or unexported fields
}

CacheStorageConfig is a struct that backs a llm_proxy_cache.json file, which configures the cache storage object

func NewCacheStorageConfig

func NewCacheStorageConfig(cacheDir string) (*CacheStorageConfig, error)

NewCacheStorageConfig creates a new IndexFile object to help with loading/saving meta-state as a json file. This object's purpose is to help loading the other database objects by pointing to their connection settings or file paths.

cacheDir: the directory where the cache index file will be stored

func (*CacheStorageConfig) Load

func (i *CacheStorageConfig) Load() error

Load reads the cache config json file from disk

func (CacheStorageConfig) Save

func (i CacheStorageConfig) Save() error

Save writes the cache config json file to disk

type Config

type Config struct {
	AppMode AppMode

	Cache *cacheBehavior
	// contains filtered or unexported fields
}

Config is the main config mega-struct

func NewDefaultConfig

func NewDefaultConfig() *Config

func (*Config) IsDebugEnabled

func (cfg *Config) IsDebugEnabled() int

func (*Config) IsVerboseOrHigher

func (cfg *Config) IsVerboseOrHigher() bool

IsVerboseOrHigher returns 1 if the log level is verbose or higher

func (*Config) SetLoggerLevel

func (cfg *Config) SetLoggerLevel()

type LogSourceConfig

type LogSourceConfig struct {
	LogConnectionStats bool
	LogRequestHeaders  bool
	LogRequest         bool
	LogResponseHeaders bool
	LogResponse        bool
}

LogSourceConfig holds the configuration toggles for logging request and response data

func NewLogSourceConfig

func NewLogSourceConfig(cfg *Config) LogSourceConfig

func (*LogSourceConfig) String

func (l *LogSourceConfig) String() string

type TrafficLogFormat

type TrafficLogFormat int
const (
	TrafficLog_JSON TrafficLogFormat = iota
	TrafficLog_TXT
)

func StringToTrafficLogFormat

func StringToTrafficLogFormat(logFormat string) (TrafficLogFormat, error)

StringToTrafficLogFormat converts a string to a LogLevel enum value.

Jump to

Keyboard shortcuts

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