Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var GetEmailSender = func(cfg *config.Mail) EmailSender { return email.NewSMTPSender(cfg) }
GetEmailSender creates an email sender using the email package
View Source
var GetHTTPServer = func(bindAddr string, router http.Handler) HTTPServer { s := dphttp.NewServer(bindAddr, router) s.HandleOSSignals = false return s }
GetHTTPServer creates an http server and sets the Server
View Source
var GetHealthCheck = func(cfg *config.Config, buildTime, gitCommit, version string) (HealthChecker, error) { versionInfo, err := healthcheck.NewVersionInfo(buildTime, gitCommit, version) if err != nil { return nil, fmt.Errorf("failed to get version info: %w", err) } hc := healthcheck.New( versionInfo, cfg.HealthCheckCriticalTimeout, cfg.HealthCheckInterval, ) return &hc, nil }
GetHealthCheck creates a healthcheck with versionInfo
Functions ¶
This section is empty.
Types ¶
type EmailSender ¶
EmailSender defines the required methods to send emails
type HTTPServer ¶
HTTPServer defines the required methods from the HTTP server
type HealthChecker ¶
type HealthChecker interface { Handler(w http.ResponseWriter, req *http.Request) Start(ctx context.Context) Stop() AddCheck(name string, checker healthcheck.Checker) (err error) }
HealthChecker defines the required methods from Healthcheck
type Service ¶
type Service struct { Config *config.Config Server HTTPServer API *api.API EmailSender EmailSender HealthCheck HealthChecker }
Service contains all the configs, server and clients to run the API
Click to show internal directories.
Click to hide internal directories.