config

package
v0.260224.1130 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2026 License: MPL-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthMiddleware

func AuthMiddleware(cfg *Config) gin.HandlerFunc

AuthMiddleware creates a Gin middleware for JWT authentication

Types

type Config

type Config struct {
	Port             int           // HTTP server port
	JWTSecret        string        // JWT secret for token validation
	UserToken        string        // User token from main service (legacy auth)
	DBPath           string        // SQLite database path for remote-coder
	SessionTimeout   time.Duration // Session timeout duration
	MessageRetention time.Duration // How long to retain messages
	RateLimitMax     int           // Max auth attempts before block
	RateLimitWindow  time.Duration // Time window for rate limiting
	RateLimitBlock   time.Duration // Block duration after exceeding limit
	// contains filtered or unexported fields
}

Config holds the configuration for remote-coder service Remote-coder specific configuration only - AgentBoot config is loaded directly by agentboot

func LoadFromAppConfig

func LoadFromAppConfig(appCfg *serverconfig.Config, opts Options) (*Config, error)

LoadFromAppConfig builds remote-coder config from the main app config with env/override support.

func (*Config) GenerateToken

func (cfg *Config) GenerateToken(clientID string, expiryHours int) (string, error)

GenerateToken generates a new API token for a client

func (*Config) NewRateLimiter

func (cfg *Config) NewRateLimiter() *middleware.RateLimiter

NewRateLimiter creates a rate limiter from config

func (*Config) ValidateToken

func (cfg *Config) ValidateToken(tokenString string) (*auth.Claims, error)

ValidateToken validates an API token and returns the claims

type ConfigError

type ConfigError struct {
	Field   string
	Message string
}

ConfigError represents a configuration error

func (*ConfigError) Error

func (e *ConfigError) Error() string

type Options

type Options struct {
	Port                 *int
	DBPath               *string
	SessionTimeout       *time.Duration
	MessageRetentionDays *int
	RateLimitMax         *int
	RateLimitWindow      *time.Duration
	RateLimitBlock       *time.Duration
	JWTSecret            *string
}

Options allows overrides when building remote-coder configuration.

Jump to

Keyboard shortcuts

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