gateway

package
v0.0.0-...-71516e3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 28, 2024 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrSubdomainDoesNotMatchRegex = errors.New("subdomain does not match regex")
)

Functions

func Subdomain

func Subdomain(externalURL string, backendRepo SubdomainBackendRepo, redisClient *common.RedisClient) echo.MiddlewareFunc

Subdomain is middleware that routes requests based on the subdomain format.

It extracts either a deployment's subdomain or a stub ID from the request's host. Based on the extracted value, it fetches the corresponding deployment or stub, builds the appropriate handler path, and invokes the corresponding handler.

Supported Subdomain Formats: - {subdomain}.app.example.com // Routes to the "latest" version of a deployment - {subdomain}-latest.app.example.com // Routes to the "latest" version of a deployment - {subdomain}-v{version}.app.example.com // Routes to a specific version of a deployment - {stubId}.app.example.com // Routes to a specified stub, typically used for serves

Types

type SubdomainBackendRepo

type SubdomainBackendRepo interface {
	GetStubByExternalId(ctx context.Context, externalId string, queryFilters ...types.QueryFilter) (*types.StubWithRelated, error)
	GetDeploymentBySubdomain(ctx context.Context, subdomain string, version uint) (*types.DeploymentWithRelated, error)
}

type SubdomainFields

type SubdomainFields struct {
	Name      string
	Version   uint
	StubId    string
	Subdomain string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL