@@ -56,12 +56,6 @@ type tlsManager struct {
5656 // nil.
5757 extTLSConf * aghtls.ExtendedTLSConfig
5858
59- // web is the web UI and API server. It must not be nil.
60- //
61- // TODO(s.chzhen): Temporary cyclic dependency due to ongoing refactoring.
62- // Resolve it.
63- web * webAPI
64-
6559 // rootCerts is a pool of root CAs for TLSv1.2.
6660 rootCerts * x509.CertPool
6761
@@ -106,8 +100,7 @@ type tlsManagerConfig struct {
106100// newTLSManager initializes the manager of TLS configuration. m is always
107101// non-nil while any returned error indicates that the TLS configuration isn't
108102// valid. Thus TLS may be initialized later, e.g. via the web UI. conf must
109- // not be nil. Note that [tlsManager.web] must be initialized later on by using
110- // [tlsManager.setWebAPI].
103+ // not be nil.
111104func newTLSManager (ctx context.Context , conf * tlsManagerConfig ) (m * tlsManager , err error ) {
112105 m = & tlsManager {
113106 logger : conf .logger ,
@@ -185,14 +178,6 @@ func newTLSManager(ctx context.Context, conf *tlsManagerConfig) (m *tlsManager,
185178 return m , nil
186179}
187180
188- // setWebAPI stores the provided web API. It must be called before
189- // [tlsManager.Start], [tlsManager.reload] or [webAPI.validateTLSSettings].
190- //
191- // TODO(s.chzhen): Remove it once cyclic dependency is resolved.
192- func (m * tlsManager ) setWebAPI (webAPI * webAPI ) {
193- m .web = webAPI
194- }
195-
196181// setCertFileTime sets [tlsManager.certLastMod] from the certificate. If there
197182// are errors, setCertFileTime logs them. m.mu is expected to be locked.
198183func (m * tlsManager ) setCertFileTime (ctx context.Context ) {
@@ -1033,14 +1018,6 @@ var _ service.Interface = (*tlsManager)(nil)
10331018// Start implements the [service.Interface] interface for *tlsManager. It
10341019// starts the TLS manager.
10351020func (m * tlsManager ) Start (ctx context.Context ) (err error ) {
1036- m .mu .Lock ()
1037- defer m .mu .Unlock ()
1038-
1039- // The background context is used because the TLSConfigChanged wraps context
1040- // with timeout on its own and shuts down the server, which handles current
1041- // request.
1042- m .web .tlsConfigChanged (context .Background (), m .extTLSConf )
1043-
10441021 go m .handleCertFileChange (ctx )
10451022
10461023 return nil
0 commit comments