server

package
v0.8.4 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2025 License: Apache-2.0 Imports: 37 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HealthHandler

func HealthHandler(ctx *gin.Context)

func IndexHandler

func IndexHandler(ctx *gin.Context)

func IndexRedirectHandler

func IndexRedirectHandler(ctx *gin.Context)

func SetupRoutes

func SetupRoutes(cfg *Config, svc *Services, hub *ws.WebsocketHub) http.Handler

Types

type Config

type Config struct {
	HTTP    HTTPConfig    `mapstructure:"http"`
	Blob    blob.S3Config `mapstructure:"blob"`
	Auth    auth.Config   `mapstructure:"auth"`
	Email   email.Config  `mapstructure:"email"`
	DataDir string        `mapstructure:"data_dir"`
	LogDir  string        `mapstructure:"log_dir"`
}

Config holds the overall server configuration.

func (Config) LogValue

func (c Config) LogValue() slog.Value

LogValue for Config

func (*Config) Validate

func (c *Config) Validate() error

Validate checks the configuration for essential values and consistency.

type HTTPConfig

type HTTPConfig struct {
	Addr         string `mapstructure:"addr"`
	CertFilePath string `mapstructure:"cert_file"`
	KeyFilePath  string `mapstructure:"key_file"`
	Domain       string `mapstructure:"domain"` // Main domain for subdomain routing (e.g., "syftbox.net")
}

HTTPConfig holds HTTP server specific configuration.

func (*HTTPConfig) HTTPSEnabled

func (c *HTTPConfig) HTTPSEnabled() bool

func (HTTPConfig) LogValue

func (hc HTTPConfig) LogValue() slog.Value

LogValue for HTTPConfig

func (*HTTPConfig) Validate

func (c *HTTPConfig) Validate() error

type Server

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

Server represents the main application server and its dependencies

func New

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

New creates a new server instance with the provided configuration

func (*Server) Start

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

func (*Server) Stop

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

type Services

type Services struct {
	Blob      *blob.BlobService
	ACL       *acl.ACLService
	Datasite  *datasite.DatasiteService
	Auth      *auth.AuthService
	Email     *email.EmailService
	AccessLog *accesslog.AccessLogger
}

func NewServices

func NewServices(config *Config, db *sqlx.DB) (*Services, error)

func (*Services) Shutdown

func (s *Services) Shutdown(ctx context.Context) error

func (*Services) Start

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

Directories

Path Synopsis
handlers
acl
api
did
ws

Jump to

Keyboard shortcuts

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