Documentation
¶
Overview ¶
Package previewnames builds automatic preview host labels (ADR 090). It is pure: no I/O and no store access.
Index ¶
- Constants
- func Assign(in Input, p Policy, taken func(label string) bool) (string, error)
- func DefaultReserved() []string
- func Host(label, domain string) string
- func Label(in Input) string
- func Resolve(stored string, in Input, p Policy, taken func(label string) bool) (string, error)
- func Slug(s string) string
- type Input
- type NoFreeNameError
- type Policy
- type Style
Constants ¶
const MaxLabelLen = 63
MaxLabelLen is the DNS limit for one label.
Variables ¶
This section is empty.
Functions ¶
func Assign ¶
Assign picks a free label: the base label, then -2, -3 and so on, up to MaxAttempts numbered tries. taken reports labels already owned by an app or a preview. Provider zone records are not checked here.
func DefaultReserved ¶
func DefaultReserved() []string
DefaultReserved mirrors the previews.domain_reserved_labels default.
func Label ¶
Label returns the base label for a preview, at most 63 characters, with no reserved or collision handling.
Types ¶
type NoFreeNameError ¶
NoFreeNameError reports that every candidate label was taken.
func (*NoFreeNameError) Error ¶
func (e *NoFreeNameError) Error() string
type Style ¶
type Style string
Style picks how a preview label is formed.
const ( StylePR Style = "pr" StyleBranch Style = "branch" StyleReadable Style = "readable" // StyleBranchDeploy is for branch deploys only and keeps the -br- infix of the deploy app name. StyleBranchDeploy Style = "branch-deploy" )
Supported styles. pr is the default and matches the label used today.