Documentation
¶
Overview ¶
Package config provides Docker container label parsing for roji configuration.
It extracts routing configuration from Docker labels such as:
- roji.host: Custom hostname
- roji.port: Target port
- roji.path: Path prefix for path-based routing
Index ¶
Constants ¶
View Source
const ( // Label prefix for all roji-related labels LabelPrefix = "roji." // Supported labels LabelHost = LabelPrefix + "host" // Custom hostname (default: {service}.{domain}) LabelPort = LabelPrefix + "port" // Target port when multiple ports exposed LabelPath = LabelPrefix + "path" // Path prefix for routing (optional) // Mock labels prefix LabelMockPrefix = LabelPrefix + "mock." // roji.mock.GET./path = response body LabelMockStatusPrefix = LabelMockPrefix + "status." // roji.mock.status.GET./path = status code )
Variables ¶
This section is empty.
Functions ¶
func DefaultHostname ¶
DefaultHostname generates a default hostname from service name and base domain e.g., ("myapp", "kan.localhost") -> "myapp.kan.localhost"
Types ¶
type MockRoute ¶ added in v0.6.0
type MockRoute struct {
Method string // HTTP method (GET, POST, etc.)
Path string // URL path (e.g., "/api/users")
Body string // Response body
StatusCode int // HTTP status code (default: 200)
}
MockRoute defines a mock response for a specific method and path
type RouteConfig ¶
type RouteConfig struct {
Host string // e.g., "myapp.localhost"
Port int // Target port
PathPrefix string // e.g., "/api" (optional)
MockRoutes []*MockRoute // Mock responses for this container
}
RouteConfig holds the configuration for a single route
func ParseLabels ¶
func ParseLabels(labels map[string]string) *RouteConfig
ParseLabels extracts roji configuration from container labels
Click to show internal directories.
Click to hide internal directories.