Documentation
¶
Index ¶
Constants ¶
const ( DefaultHTTPPort = 80 DefaultHTTPSPort = 443 DefaultAdminPort = 8080 ReadTimeout = 15 * time.Second WriteTimeout = 15 * time.Second IdleTimeout = 60 * time.Second TLSMinVersion = tls.VersionTLS12 ShutdownGracePeriod = 30 * time.Second )
Constants for default configurations
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server encapsulates all the components and configurations required to run the Terraster server. It manages HTTP/HTTPS servers, health checkers, admin APIs, TLS configurations, and service pools.
func NewServer ¶
func NewServer( srvCtx context.Context, errChan chan<- error, cfg *config.Config, authSrvc *auth_service.AuthService, zLog *zap.Logger, logManager *logger.LoggerManager, ) (*Server, error)
NewServer initializes a new Server instance with the provided configurations and dependencies. It sets up health checkers for each service, initializes the admin API, and prepares the server for startup. Returns an error if any component fails to initialize.
func (*Server) Shutdown ¶
Shutdown gracefully shuts down all running servers, including the admin server and all service servers. It also stops all health checkers and waits for all goroutines to finish within the provided context's deadline. Returns an error if the shutdown process is interrupted or fails.
func (*Server) Start ¶
Start initializes and starts all configured HTTP/HTTPS servers along with the admin server. It sets up TLS configurations, loads certificates, and begins listening for incoming requests. Also starts all health checkers in separate goroutines. Returns an error if any server fails to start.