MCPcopy
hub / github.com/cloudflare/cloudflared / parseCLIIngress

Function parseCLIIngress

ingress/ingress.go:130–148  ·  view source on GitHub ↗

parseCLIIngress constructs an Ingress set with only one rule constructed from CLI parameters: --url, --hello-world, --bastion, or --unix-socket

(c *cli.Context, allowURLFromArgs bool)

Source from the content-addressed store, hash-verified

128// parseCLIIngress constructs an Ingress set with only one rule constructed from
129// CLI parameters: --url, --hello-world, --bastion, or --unix-socket
130func parseCLIIngress(c *cli.Context, allowURLFromArgs bool) (Ingress, error) {
131 service, err := parseSingleOriginService(c, allowURLFromArgs)
132 if err != nil {
133 return Ingress{}, err
134 }
135
136 // Construct an Ingress with the single rule.
137 defaults := originRequestFromSingleRule(c)
138 ing := Ingress{
139 Rules: []Rule{
140 {
141 Service: service,
142 Config: setConfig(defaults, config.OriginRequestConfig{}),
143 },
144 },
145 Defaults: defaults,
146 }
147 return ing, err
148}
149
150// newDefaultOrigin always returns a 503 response code to help indicate that there are no ingress
151// rules setup, but the tunnel is reachable.

Callers 4

TestSingleOriginServicesFunction · 0.85

Calls 3

parseSingleOriginServiceFunction · 0.85
setConfigFunction · 0.85

Tested by 3

TestSingleOriginServicesFunction · 0.68