Documentation
¶
Index ¶
- func ContainerName(project, environment, service string, replica int) string
- func Errorf(format string, args ...interface{}) error
- func ImageTag(project, service, version, environment string) string
- func IsValidUnixUsername(name string) bool
- func JoinNonEmpty(sep string, parts ...string) string
- func NetworkName(project, environment string) string
- func Quote(s string) string
- func SanitizeDomainForLabel(domain string) string
- func SanitizeName(name string) string
- func ShellQuote(s string) string
- func TruncateString(s string, maxLength int) string
- func Wrapf(err error, format string, args ...interface{}) error
- type DockerLabelBuilder
- func (b *DockerLabelBuilder) Add(key, value string) *DockerLabelBuilder
- func (b *DockerLabelBuilder) AddIf(condition bool, key, value string) *DockerLabelBuilder
- func (b *DockerLabelBuilder) AddRaw(label string) *DockerLabelBuilder
- func (b *DockerLabelBuilder) AddWithQuotes(key, value, quoteType string) *DockerLabelBuilder
- func (b *DockerLabelBuilder) Build() string
- func (b *DockerLabelBuilder) BuildSlice() []string
- func (b *DockerLabelBuilder) Count() int
- type Error
- type MultiError
- type RedirectDomainBuilder
- type TraefikLabelBuilder
- func (t *TraefikLabelBuilder) Enable() *TraefikLabelBuilder
- func (t *TraefikLabelBuilder) Entrypoints(entrypoints ...string) *TraefikLabelBuilder
- func (t *TraefikLabelBuilder) HealthCheck(path string, interval string) *TraefikLabelBuilder
- func (t *TraefikLabelBuilder) HostRule(domain string) *TraefikLabelBuilder
- func (t *TraefikLabelBuilder) Middlewares(middlewares ...string) *TraefikLabelBuilder
- func (t *TraefikLabelBuilder) Port(port int) *TraefikLabelBuilder
- func (t *TraefikLabelBuilder) Priority(priority int) *TraefikLabelBuilder
- func (t *TraefikLabelBuilder) RedirectRegexMiddleware(middlewareName, fromDomain, toDomain string, permanent bool) *TraefikLabelBuilder
- func (t *TraefikLabelBuilder) Service(serviceName string) *TraefikLabelBuilder
- func (t *TraefikLabelBuilder) TLS(certResolver string) *TraefikLabelBuilder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContainerName ¶
ContainerName generates a standardized container name
func IsValidUnixUsername ¶ added in v0.2.4
IsValidUnixUsername validates that a string is a safe POSIX username. Rules: starts with letter or underscore, contains only letters, digits, underscores, and hyphens, max 32 characters.
func JoinNonEmpty ¶
JoinNonEmpty joins non-empty strings with a separator
func NetworkName ¶
NetworkName generates a standardized network name
func SanitizeDomainForLabel ¶
SanitizeDomainForLabel converts a domain to a safe label name Example: "app.example.com" → "app-example-com"
func SanitizeName ¶
SanitizeName sanitizes a string for use in Docker/network names Replaces invalid characters with underscores
func ShellQuote ¶ added in v0.2.4
ShellQuote wraps a string in single quotes with proper escaping for safe use in shell commands. Single quotes within the string are handled by ending the quoted section, adding an escaped single quote, and resuming quoting.
func TruncateString ¶
TruncateString truncates a string to maxLength, adding "..." if truncated
Types ¶
type DockerLabelBuilder ¶
type DockerLabelBuilder struct {
// contains filtered or unexported fields
}
DockerLabelBuilder helps build Docker labels in a type-safe way
func NewDockerLabelBuilder ¶
func NewDockerLabelBuilder() *DockerLabelBuilder
NewDockerLabelBuilder creates a new label builder
func (*DockerLabelBuilder) Add ¶
func (b *DockerLabelBuilder) Add(key, value string) *DockerLabelBuilder
Add adds a label with key and value
func (*DockerLabelBuilder) AddIf ¶
func (b *DockerLabelBuilder) AddIf(condition bool, key, value string) *DockerLabelBuilder
AddIf conditionally adds a label if condition is true
func (*DockerLabelBuilder) AddRaw ¶
func (b *DockerLabelBuilder) AddRaw(label string) *DockerLabelBuilder
AddRaw adds a raw label string (use with caution)
func (*DockerLabelBuilder) AddWithQuotes ¶
func (b *DockerLabelBuilder) AddWithQuotes(key, value, quoteType string) *DockerLabelBuilder
AddWithQuotes adds a label with the value wrapped in the specified quote type quoteType can be "single" or "double"
func (*DockerLabelBuilder) Build ¶
func (b *DockerLabelBuilder) Build() string
Build returns the labels as a space-separated string
func (*DockerLabelBuilder) BuildSlice ¶
func (b *DockerLabelBuilder) BuildSlice() []string
BuildSlice returns the labels as a slice
func (*DockerLabelBuilder) Count ¶
func (b *DockerLabelBuilder) Count() int
Count returns the number of labels
type Error ¶
type Error struct {
Operation string // What operation was being performed
Cause error // The underlying error
Details []string // Additional context
}
Error represents a Tako CLI error with context
type MultiError ¶
type MultiError struct {
Errors []error
}
Multi error type for collecting multiple errors
func (*MultiError) ErrorOrNil ¶
func (m *MultiError) ErrorOrNil() error
ErrorOrNil returns the error if there are any, otherwise nil
func (*MultiError) HasErrors ¶
func (m *MultiError) HasErrors() bool
HasErrors returns true if there are any errors
type RedirectDomainBuilder ¶ added in v0.0.3
type RedirectDomainBuilder struct {
// contains filtered or unexported fields
}
RedirectDomainBuilder helps build redirect configurations for domain redirects
func NewRedirectDomainBuilder ¶ added in v0.0.3
func NewRedirectDomainBuilder(containerName, primaryDomain string) *RedirectDomainBuilder
NewRedirectDomainBuilder creates a new redirect domain builder
func (*RedirectDomainBuilder) AddRedirectDomain ¶ added in v0.0.3
func (r *RedirectDomainBuilder) AddRedirectDomain(redirectDomain string, index int, certResolver string) *RedirectDomainBuilder
AddRedirectDomain adds a domain that should redirect to the primary domain
func (*RedirectDomainBuilder) Build ¶ added in v0.0.3
func (r *RedirectDomainBuilder) Build() string
Build returns all redirect labels as a space-separated string
func (*RedirectDomainBuilder) BuildSlice ¶ added in v0.0.3
func (r *RedirectDomainBuilder) BuildSlice() []string
BuildSlice returns all redirect labels as a slice
type TraefikLabelBuilder ¶
type TraefikLabelBuilder struct {
*DockerLabelBuilder
// contains filtered or unexported fields
}
TraefikLabelBuilder specifically for Traefik labels
func NewTraefikLabelBuilder ¶
func NewTraefikLabelBuilder(routerName, serviceName string) *TraefikLabelBuilder
NewTraefikLabelBuilder creates a builder for Traefik labels
func (*TraefikLabelBuilder) Enable ¶
func (t *TraefikLabelBuilder) Enable() *TraefikLabelBuilder
Enable enables Traefik for this container
func (*TraefikLabelBuilder) Entrypoints ¶
func (t *TraefikLabelBuilder) Entrypoints(entrypoints ...string) *TraefikLabelBuilder
Entrypoints sets the entrypoints for the router
func (*TraefikLabelBuilder) HealthCheck ¶
func (t *TraefikLabelBuilder) HealthCheck(path string, interval string) *TraefikLabelBuilder
HealthCheck adds health check configuration
func (*TraefikLabelBuilder) HostRule ¶
func (t *TraefikLabelBuilder) HostRule(domain string) *TraefikLabelBuilder
HostRule adds a Host() rule for the router
func (*TraefikLabelBuilder) Middlewares ¶ added in v0.0.3
func (t *TraefikLabelBuilder) Middlewares(middlewares ...string) *TraefikLabelBuilder
Middlewares adds middleware(s) to the router
func (*TraefikLabelBuilder) Port ¶
func (t *TraefikLabelBuilder) Port(port int) *TraefikLabelBuilder
Port sets the service port
func (*TraefikLabelBuilder) Priority ¶
func (t *TraefikLabelBuilder) Priority(priority int) *TraefikLabelBuilder
Priority sets the router priority
func (*TraefikLabelBuilder) RedirectRegexMiddleware ¶ added in v0.0.3
func (t *TraefikLabelBuilder) RedirectRegexMiddleware(middlewareName, fromDomain, toDomain string, permanent bool) *TraefikLabelBuilder
RedirectRegexMiddleware creates a redirect regex middleware This is used to redirect one domain to another (e.g., www -> non-www)
func (*TraefikLabelBuilder) Service ¶
func (t *TraefikLabelBuilder) Service(serviceName string) *TraefikLabelBuilder
Service links the router to a specific service
func (*TraefikLabelBuilder) TLS ¶
func (t *TraefikLabelBuilder) TLS(certResolver string) *TraefikLabelBuilder
TLS enables TLS for the router