set Local to false...
This commit is contained in:
parent
143e4df5b2
commit
6a1242813b
@ -206,6 +206,33 @@ func (s serve) action(ctx context.Context, command *cli.Command) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
requests := command.StringSlice(addRequestsFlagName)
|
||||||
|
log.Info().Msgf("%d", len(requests))
|
||||||
|
if len(requests) > 0 {
|
||||||
|
clear(containerMethodRegex)
|
||||||
|
for _, request := range requests {
|
||||||
|
// An applicator is a container name/HTTP method pair e.g., nginx(GET).
|
||||||
|
// The following regex extracts this applicator and the associated URL regex.
|
||||||
|
aur := applicatorURLRegex.FindString(request)
|
||||||
|
if aur == "" {
|
||||||
|
// If we are here, it means that user set a wildcard (kinda) applicator e.g., GET,POST:URL_REGEX.
|
||||||
|
// In its extended form, this applicator can be read as follows: *(GET,POST):URL_REGEX.
|
||||||
|
methods, urlRegex, ok := strings.Cut(request, ":")
|
||||||
|
if !ok { // || methods == ""?
|
||||||
|
return errors.New("HTTP method(s) must be specified before ':'")
|
||||||
|
}
|
||||||
|
if err = registerMethodRegex("*", urlRegex, strings.Split(methods, ",")); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
applicator, urlRegex, _ := strings.Cut(aur, ":")
|
||||||
|
if err = registerMethodRegex(containerNameRegex.FindString(applicator), urlRegex, httpMethodsRegex.FindAllString(applicator, -1)); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
var l net.Listener
|
var l net.Listener
|
||||||
l, err = net.Listen("tcp", ap.srvAddrPort.String())
|
l, err = net.Listen("tcp", ap.srvAddrPort.String())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -417,10 +444,11 @@ func addRequests() cli.Flag {
|
|||||||
Category: "network",
|
Category: "network",
|
||||||
Usage: "add requests",
|
Usage: "add requests",
|
||||||
Sources: middleman.PluckEnvVar(EnvVarPrefix, addRequestsFlagName),
|
Sources: middleman.PluckEnvVar(EnvVarPrefix, addRequestsFlagName),
|
||||||
Local: true, // Required to trigger the Action when this flag is set via the environment variable, see https://github.com/urfave/cli/issues/2041.
|
// Local: true, // Required to trigger the Action when this flag is set via the environment variable, see https://github.com/urfave/cli/issues/2041.
|
||||||
Value: []string{"*:" + defaultAllowedRequest},
|
Value: []string{"*:" + defaultAllowedRequest},
|
||||||
Aliases: middleman.PluckAlias(ServeCmd, addRequestsFlagName),
|
Aliases: middleman.PluckAlias(ServeCmd, addRequestsFlagName),
|
||||||
Action: func(ctx context.Context, command *cli.Command, requests []string) error {
|
Action: func(ctx context.Context, command *cli.Command, requests []string) error {
|
||||||
|
log.Info().Msgf("%d", len(requests))
|
||||||
clear(containerMethodRegex)
|
clear(containerMethodRegex)
|
||||||
for _, request := range requests {
|
for _, request := range requests {
|
||||||
// An applicator is a container name/HTTP method pair e.g., nginx(GET).
|
// An applicator is a container name/HTTP method pair e.g., nginx(GET).
|
||||||
|
Loading…
x
Reference in New Issue
Block a user