Documentation
¶
Index ¶
- func BuildExternalHostname(sessionName, serviceName, projectAlias, domain string) string
- func BuildHostname(sessionName, serviceName, projectAlias string) string
- func BuildRouteID(sessionName, serviceName, projectAlias string) string
- func NormalizeDNSName(serviceName string) string
- func SanitizeHostname(sessionName string) string
- func SyncRoutes(sessions map[string]*SessionInfo) error
- type CaddyAdmin
- type CaddyApps
- type CaddyClient
- type CaddyConfig
- type CaddyHTTP
- type CaddyServer
- type HealthCheckResult
- type Route
- type RouteHandler
- type RouteHeaderOps
- type RouteHeaders
- type RouteMatch
- type RouteStatus
- type RouteUpstream
- type SessionInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildExternalHostname ¶ added in v0.3.0
BuildExternalHostname constructs the hostname for a session/service on an external domain. Returns "" if the service name normalizes to empty or domain is empty.
func BuildHostname ¶ added in v0.2.0
BuildHostname constructs the hostname for a session/service combination. Returns "" if the service name normalizes to empty. Labels are capped at 63 characters per RFC 1035; longer labels are truncated with a 4-character hash appended to preserve uniqueness.
func BuildRouteID ¶ added in v0.2.0
BuildRouteID constructs the route ID for a session/service combination. Returns "" if the service name normalizes to empty.
func NormalizeDNSName ¶
NormalizeDNSName converts a service name to be DNS-compatible
func SanitizeHostname ¶
SanitizeHostname converts a session name to be hostname-compatible. Unlike NormalizeDNSName, it also converts slashes to hyphens (for branch names like "feature/foo").
func SyncRoutes ¶ added in v0.2.0
func SyncRoutes(sessions map[string]*SessionInfo) error
SyncRoutes generates the Caddy config file and reloads Caddy. It writes the config even if Caddy is not running, so the next Caddy start picks up the correct routes.
Types ¶
type CaddyAdmin ¶ added in v0.2.0
type CaddyAdmin struct {
Listen string `json:"listen"`
}
CaddyAdmin represents the admin API configuration
type CaddyApps ¶ added in v0.2.0
type CaddyApps struct {
HTTP CaddyHTTP `json:"http"`
}
CaddyApps contains the HTTP app configuration
type CaddyClient ¶
type CaddyClient struct {
// contains filtered or unexported fields
}
CaddyClient manages communication with Caddy's admin API
func NewCaddyClient ¶
func NewCaddyClient() *CaddyClient
NewCaddyClient creates a new Caddy API client
func (*CaddyClient) CheckCaddyConnection ¶
func (c *CaddyClient) CheckCaddyConnection() error
CheckCaddyConnection verifies that Caddy is running and accessible
func (*CaddyClient) GetAllRoutes ¶
func (c *CaddyClient) GetAllRoutes() ([]Route, error)
GetAllRoutes retrieves all routes from Caddy
type CaddyConfig ¶ added in v0.2.0
type CaddyConfig struct {
Admin CaddyAdmin `json:"admin"`
Apps CaddyApps `json:"apps"`
}
CaddyConfig represents the full Caddy JSON configuration
func BuildCaddyConfig ¶ added in v0.2.0
func BuildCaddyConfig(sessions map[string]*SessionInfo) CaddyConfig
BuildCaddyConfig generates the complete Caddy JSON config from session data
type CaddyHTTP ¶ added in v0.2.0
type CaddyHTTP struct {
Servers map[string]CaddyServer `json:"servers"`
}
CaddyHTTP contains the HTTP server configuration
type CaddyServer ¶ added in v0.2.0
CaddyServer represents a single HTTP server
type HealthCheckResult ¶
type HealthCheckResult struct {
CaddyRunning bool
CaddyError string
RouteStatuses []RouteStatus
RoutesNeeded int
RoutesExisting int
}
HealthCheckResult contains the overall Caddy health status
func CheckCaddyHealth ¶
func CheckCaddyHealth(sessions map[string]*SessionInfo) (*HealthCheckResult, error)
CheckCaddyHealth performs a comprehensive health check of Caddy and all routes
type Route ¶
type Route struct {
ID string `json:"@id"`
Match []RouteMatch `json:"match"`
Handle []RouteHandler `json:"handle"`
Terminal bool `json:"terminal"`
}
Route represents a Caddy route configuration
type RouteHandler ¶
type RouteHandler struct {
Handler string `json:"handler"`
Upstreams []RouteUpstream `json:"upstreams,omitempty"`
Headers *RouteHeaders `json:"headers,omitempty"`
}
RouteHandler represents a route handler
type RouteHeaderOps ¶ added in v0.3.0
RouteHeaderOps holds header set/add/delete operations.
type RouteHeaders ¶ added in v0.3.0
type RouteHeaders struct {
Request *RouteHeaderOps `json:"request,omitempty"`
}
RouteHeaders configures header manipulation in a reverse_proxy handler.
type RouteMatch ¶
type RouteMatch struct {
Host []string `json:"host"`
}
RouteMatch represents the match criteria for a route
type RouteStatus ¶
type RouteStatus struct {
SessionName string
ServiceName string
RouteID string
Hostname string
Port int
Exists bool
Error string
}
RouteStatus represents the status of a Caddy route
type RouteUpstream ¶
type RouteUpstream struct {
Dial string `json:"dial"`
}
RouteUpstream represents an upstream server