chore: make default workspace proxy editable (#7903)

* chore: add editing the default workspace proxy
This commit is contained in:
Steven Masley
2023-06-08 10:30:15 -05:00
committed by GitHub
parent 5e647ba07a
commit fa8153a0fd
20 changed files with 453 additions and 52 deletions

View File

@ -72,6 +72,11 @@ func New(ctx context.Context, options *Options) (*API, error) {
RedirectToLogin: false,
})
deploymentID, err := options.Database.GetDeploymentID(ctx)
if err != nil {
return nil, xerrors.Errorf("failed to get deployment ID: %w", err)
}
api.AGPL.APIHandler.Group(func(r chi.Router) {
r.Get("/entitlements", api.serveEntitlements)
// /regions overrides the AGPL /regions endpoint
@ -118,7 +123,7 @@ func New(ctx context.Context, options *Options) (*API, error) {
r.Route("/{workspaceproxy}", func(r chi.Router) {
r.Use(
apiKeyMiddleware,
httpmw.ExtractWorkspaceProxyParam(api.Database),
httpmw.ExtractWorkspaceProxyParam(api.Database, deploymentID, api.AGPL.PrimaryWorkspaceProxy),
)
r.Get("/", api.workspaceProxy)
@ -225,7 +230,6 @@ func New(ctx context.Context, options *Options) (*API, error) {
RootCAs: meshRootCA,
ServerName: options.AccessURL.Hostname(),
}
var err error
api.replicaManager, err = replicasync.New(ctx, options.Logger, options.Database, options.Pubsub, &replicasync.Options{
ID: api.AGPL.ID,
RelayAddress: options.DERPServerRelayAddress,