server

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2025 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddServerFlags

func AddServerFlags(cmd *cobra.Command, config *Config)

AddServerFlags adds server configuration flags to a cobra command

func AddServerFlagsLegacy

func AddServerFlagsLegacy(config *Config)

AddServerFlagsLegacy adds server configuration flags using pflag (for backward compatibility)

Types

type Config

type Config struct {
	// Version Information
	Version   string
	GitCommit string
	BuildDate string

	// Network Configuration
	GRPCAddr string
	HTTPAddr string

	// Storage Configuration
	RedisAddr     string
	RedisPassword string
	RedisUsername string // For Redis 6+ ACL
	RedisDB       int
	RedisTLS      bool

	// Logging Configuration
	LogLevel  string
	LogFormat string

	// TLS Configuration
	EnableTLS  bool
	CertFile   string
	KeyFile    string
	CACertFile string

	// HTTP Gateway Configuration
	EnableCORS   bool
	AllowOrigins []string

	// Background Services Configuration
	SchedulerIntervalMs int // Scheduler interval in milliseconds (default: 1000ms)
	ReclaimIntervalMs   int // Reclaim service interval in milliseconds (default: 5000ms)

	// Development/Runtime Configuration
	IsDevelopment bool
}

Config holds the complete server configuration

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns a configuration suitable for development

func ParseConfigFromFlags

func ParseConfigFromFlags(cmd *cobra.Command) (*Config, error)

ParseConfigFromFlags parses configuration from cobra command flags

func ProductionConfig

func ProductionConfig() *Config

ProductionConfig returns a configuration suitable for production

func (*Config) GetTimeout

func (c *Config) GetTimeout() time.Duration

GetTimeout returns a reasonable timeout for the server configuration

func (*Config) Validate

func (c *Config) Validate() error

Validate checks if the configuration is valid

type Server

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

Server represents the ChronoQueue server instance

func New

func New(config *Config) (*Server, error)

New creates a new server instance with the given configuration

func (*Server) Start

func (s *Server) Start(ctx context.Context) error

Start initializes and starts the server

Jump to

Keyboard shortcuts

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