MCPcopy
hub / github.com/slimtoolkit/slim / GetHTTPProbeOptions

Function GetHTTPProbeOptions

pkg/app/master/command/clifvgetter.go:57–140  ·  view source on GitHub ↗
(xc *app.ExecutionContext, ctx *cli.Context)

Source from the content-addressed store, hash-verified

55}
56
57func GetHTTPProbeOptions(xc *app.ExecutionContext, ctx *cli.Context) config.HTTPProbeOptions {
58 opts := config.HTTPProbeOptions{
59 Do: ctx.Bool(FlagHTTPProbe) && !ctx.Bool(FlagHTTPProbeOff),
60 Full: ctx.Bool(FlagHTTPProbeFull),
61 ExitOnFailure: ctx.Bool(FlagHTTPProbeExitOnFailure),
62
63 StartWait: ctx.Int(FlagHTTPProbeStartWait),
64 RetryCount: ctx.Int(FlagHTTPProbeRetryCount),
65 RetryWait: ctx.Int(FlagHTTPProbeRetryWait),
66
67 CrawlMaxDepth: ctx.Int(FlagHTTPCrawlMaxDepth),
68 CrawlMaxPageCount: ctx.Int(FlagHTTPCrawlMaxPageCount),
69 CrawlConcurrency: ctx.Int(FlagHTTPCrawlConcurrency),
70 CrawlConcurrencyMax: ctx.Int(FlagHTTPMaxConcurrentCrawlers),
71 }
72
73 cmds, err := GetHTTPProbes(ctx)
74 if err != nil {
75 xc.Out.Error("param.http.probe", err.Error())
76 xc.Out.State("exited",
77 ovars{
78 "exit.code": -1,
79 })
80 xc.Exit(-1)
81 }
82 opts.Cmds = cmds
83
84 if opts.Do && len(opts.Cmds) == 0 {
85 //add default probe cmd if the "http-probe" flag is set
86 //but only if there are no custom http probe commands
87 xc.Out.Info("param.http.probe",
88 ovars{
89 "message": "using default probe",
90 })
91
92 opts.Cmds = append(opts.Cmds, GetDefaultHTTPProbe())
93
94 if ctx.Bool(FlagHTTPProbeCrawl) {
95 opts.Cmds[0].Crawl = true
96 }
97 }
98
99 if len(opts.Cmds) > 0 {
100 opts.Do = true
101 }
102
103 ports, err := ParseHTTPProbesPorts(ctx.String(FlagHTTPProbePorts))
104 if err != nil {
105 xc.Out.Error("param.http.probe.ports", err.Error())
106 xc.Out.State("exited",
107 ovars{
108 "exit.code": -1,
109 })
110 xc.Exit(-1)
111 }
112 opts.Ports = ports
113
114 opts.APISpecs = ctx.StringSlice(FlagHTTPProbeAPISpec)

Callers 1

cli.goFile · 0.92

Calls 9

GetHTTPProbesFunction · 0.85
GetDefaultHTTPProbeFunction · 0.85
ParseHTTPProbesPortsFunction · 0.85
ValidateFilesFunction · 0.85
ExitMethod · 0.80
StateMethod · 0.65
ErrorMethod · 0.45
InfoMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected