mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
refactor: use Options struct in aibridgedserver.NewServer (#27200)
Refactor `aibridgedserver.NewServer` to take an `Options` struct instead of a long list of positional arguments. Follow-up to review feedback in https://github.com/coder/coder/pull/27117#discussion_r3571535760
This commit is contained in:
@@ -134,18 +134,17 @@ func (api *API) aiGatewayServe(rw http.ResponseWriter, r *http.Request) {
|
||||
go aiGatewayCheckEntitlementAndTrackKeyUsage(connCtx, keyCtxCancel, api, gatewayKey.ID, logger)
|
||||
|
||||
mux := drpcmux.New()
|
||||
srv, err := aibridgedserver.NewServer(
|
||||
connCtx,
|
||||
api.Database,
|
||||
api.AGPL.Pubsub,
|
||||
logger,
|
||||
api.AccessURL.String(),
|
||||
api.DeploymentValues.AI.BridgeConfig,
|
||||
api.ExternalAuthConfigs,
|
||||
api.AGPL.Experiments,
|
||||
api.AGPL.AISeatTracker,
|
||||
api.AGPL.Clock,
|
||||
)
|
||||
srv, err := aibridgedserver.NewServer(connCtx, aibridgedserver.Options{
|
||||
Store: api.Database,
|
||||
Pubsub: api.AGPL.Pubsub,
|
||||
AISeatTracker: api.AGPL.AISeatTracker,
|
||||
AccessURL: api.AccessURL.String(),
|
||||
GatewayCfg: api.DeploymentValues.AI.BridgeConfig,
|
||||
ExternalAuthConfigs: api.ExternalAuthConfigs,
|
||||
Experiments: api.AGPL.Experiments,
|
||||
Logger: logger,
|
||||
Clock: api.AGPL.Clock,
|
||||
})
|
||||
if err != nil {
|
||||
if !xerrors.Is(err, context.Canceled) {
|
||||
logger.Error(connCtx, "server creation failed", slog.Error(err))
|
||||
|
||||
Reference in New Issue
Block a user