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 DefaultLogName = "service_default" )
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. 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, apiCfg *config.APIConfig, authSrvc *auth_service.AuthService, zLog *zap.Logger, logManager *logger.LoggerManager, ) (*Server, error)
Sets up health checkers for each service, initializes the admin API, setup service log (if any) and prepares the server for startup.
func (*Server) Shutdown ¶
Shutdown gracefully shuts down all running servers, including the admin server and all service servers. Also stops all health checkers and waits for all goroutines to finish within the provided context's deadline.
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.