utils

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: May 2, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExampleManifestMerger

func ExampleManifestMerger()

func FormatTimeout

func FormatTimeout(ctx context.Context, d time.Duration) (string, error)

func SanitizeString

func SanitizeString(s string) string

func ValidatePort

func ValidatePort(port int) error

Types

type AuthConfig

type AuthConfig struct {
	Token  string    `json:"token" yaml:"token"`
	Header string    `json:"header" yaml:"header"`
	Expiry time.Time `json:"expiry" yaml:"expiry"`
	Scopes []string  `json:"scopes" yaml:"scopes"`
	Meta   Metadata  `json:"_meta,omitempty" yaml:"_meta,omitempty"`
}

type Config

type Config struct {
	Version string         `json:"version" yaml:"version"`
	Name    string         `json:"name" yaml:"name"`
	Servers []ServerConfig `json:"servers" yaml:"servers"`
	Auth    *AuthConfig    `json:"auth,omitempty" yaml:"auth,omitempty"`
	Limits  *LimitsConfig  `json:"limits,omitempty" yaml:"limits,omitempty"`
	Logging *LoggingConfig `json:"logging,omitempty" yaml:"logging,omitempty"`
	Meta    Metadata       `json:"_meta,omitempty" yaml:"_meta,omitempty"`
}

type Layer

type Layer struct {
	Source string
	Config *Config
}

type LimitsConfig

type LimitsConfig struct {
	MaxConnections int      `json:"maxConnections" yaml:"maxConnections"`
	TimeoutSeconds int      `json:"timeoutSeconds" yaml:"timeoutSeconds"`
	Meta           Metadata `json:"_meta,omitempty" yaml:"_meta,omitempty"`
}

type LoggingConfig

type LoggingConfig struct {
	Level      string   `json:"level" yaml:"level"`
	Format     string   `json:"format" yaml:"format"`
	OutputPath string   `json:"outputPath" yaml:"outputPath"`
	Meta       Metadata `json:"_meta,omitempty" yaml:"_meta,omitempty"`
}

type ManifestMerger

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

func NewManifestMerger

func NewManifestMerger(logger *slog.Logger) *ManifestMerger

func (*ManifestMerger) Merge

func (m *ManifestMerger) Merge(ctx context.Context, configs ...*Config) (*Config, error)

func (*ManifestMerger) MergeFiles

func (m *ManifestMerger) MergeFiles(ctx context.Context, paths ...string) (*Config, error)

func (*ManifestMerger) MergeWithLayers

func (m *ManifestMerger) MergeWithLayers(ctx context.Context, layers ...Layer) (*MergedConfig, error)

func (*ManifestMerger) Validate

func (m *ManifestMerger) Validate(cfg *Config) error

type MergedConfig

type MergedConfig struct {
	Config    *Config             `json:"config"`
	Sources   map[string][]string `json:"sources"`
	Timestamp time.Time           `json:"timestamp"`
}

type Metadata

type Metadata struct {
	Source   string   `json:"source" yaml:"source"`
	Priority int      `json:"priority" yaml:"priority"`
	Sources  []string `json:"sources" yaml:"sources"`
}

type ServerConfig

type ServerConfig struct {
	ID       string   `json:"id" yaml:"id"`
	Command  []string `json:"command" yaml:"command"`
	Env      []string `json:"env,omitempty" yaml:"env,omitempty"`
	Port     int      `json:"port" yaml:"port"`
	Metadata Metadata `json:"_meta,omitempty" yaml:"_meta,omitempty"`
}

Jump to

Keyboard shortcuts

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