MCPcopy Create free account
hub / github.com/coder/coder / Start

Method Start

scaletest/smtpmock/server.go:53–76  ·  view source on GitHub ↗
(ctx context.Context, cfg Config)

Source from the content-addressed store, hash-verified

51var notificationTemplateIDRegex = regexp.MustCompile(`notifications\?disabled=([a-f0-9-]+)`)
52
53func (s *Server) Start(ctx context.Context, cfg Config) error {
54 s.hostAddress = cfg.HostAddress
55 s.smtpPort = cfg.SMTPPort
56 s.apiPort = cfg.APIPort
57 s.logger = cfg.Logger
58
59 s.smtpServer = smtpmocklib.New(smtpmocklib.ConfigurationAttr{
60 LogToStdout: false,
61 LogServerActivity: true,
62 HostAddress: s.hostAddress,
63 PortNumber: s.smtpPort,
64 })
65 if err := s.smtpServer.Start(); err != nil {
66 return xerrors.Errorf("start SMTP server: %w", err)
67 }
68 s.smtpPort = s.smtpServer.PortNumber()
69
70 if err := s.startAPIServer(ctx); err != nil {
71 _ = s.smtpServer.Stop()
72 return xerrors.Errorf("start API server: %w", err)
73 }
74
75 return nil
76}
77
78func (s *Server) Stop() error {
79 var httpErr, smtpErr error

Callers

nothing calls this directly

Calls 5

startAPIServerMethod · 0.95
NewMethod · 0.65
StartMethod · 0.65
StopMethod · 0.65
ErrorfMethod · 0.45

Tested by

no test coverage detected