MCPcopy
hub / github.com/caddyserver/caddy / ApplyToSegment

Method ApplyToSegment

caddyconfig/httpcaddyfile/shorthands.go:94–105  ·  view source on GitHub ↗

ApplyToSegment replaces shorthand placeholder to its full placeholder, understandable by Caddy.

(segment *caddyfile.Segment)

Source from the content-addressed store, hash-verified

92
93// ApplyToSegment replaces shorthand placeholder to its full placeholder, understandable by Caddy.
94func (s ShorthandReplacer) ApplyToSegment(segment *caddyfile.Segment) {
95 if segment != nil {
96 for i := 0; i < len(*segment); i++ {
97 // simple string replacements
98 (*segment)[i].Text = s.simple.Replace((*segment)[i].Text)
99 // complex regexp replacements
100 for _, r := range s.complex {
101 (*segment)[i].Text = r.search.ReplaceAllString((*segment)[i].Text, r.replace)
102 }
103 }
104 }
105}

Callers 2

SetupMethod · 0.95
extractNamedRoutesMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected