server

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2026 License: MIT Imports: 26 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

Types

type Config

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

	// Network Configuration
	GRPCAddr string
	HTTPAddr string

	// Storage Configuration
	StorageType      string // "sqlite" or "postgres"
	SQLiteDBPath     string // Path to SQLite database file
	PostgresDSN      string // Optional DSN override
	PostgresHost     string
	PostgresPort     int
	PostgresUser     string
	PostgresPassword string
	PostgresDBName   string
	PostgresSSLMode  string
	// PostgreSQL Client Certificate Configuration (for mTLS with database)
	PostgresClientCertFile string // Path to PostgreSQL client certificate file
	PostgresClientKeyFile  string // Path to PostgreSQL client key file
	PostgresRootCertFile   string // Path to PostgreSQL root CA certificate file
	// Logging Configuration
	LogLevel  string
	LogFormat string

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

	// Gateway TLS Configuration
	GatewayUseTLS   bool // Use TLS for gateway→gRPC internal connection
	GatewayInsecure bool // Skip TLS verification for gateway→gRPC (for localhost)

	// HTTP Gateway Configuration
	EnableCORS   bool
	AllowOrigins []string

	// API Documentation Configuration
	EnableAPIDocs       bool     // Enable API documentation endpoints (default: false in production)
	APIDocsAllowOrigins []string // Allowed CORS origins for API docs (comma-separated)

	// 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