good morning!!!!

Skip to content
Snippets Groups Projects
Commit fb460c38 authored by Thomas Guinther's avatar Thomas Guinther
Browse files

map string values to TracingOption value

parent 0152765d
Branches
Tags
No related merge requests found
......@@ -2,6 +2,8 @@ package basic
import (
"encoding/json"
"errors"
"strings"
"time"
"github.com/caddyserver/caddy/v2"
......@@ -42,6 +44,22 @@ const (
TracingOptionClientAndServer = TracingOptionClient | TracingOptionServer
)
func MapTracingOption(s string) (opt TracingOption, err error) {
switch strings.ToLower(s) {
case "disabled", "none", "off":
case "client":
opt = TracingOptionClient
case "server":
opt = TracingOptionServer
case "client-and-server", "both", "all":
opt = TracingOptionClientAndServer
default:
err = errors.New("unknown tracing option: " + s)
}
return
}
type Config struct {
RawPoolerFactory json.RawMessage `json:"pooler" caddy:"namespace=pggat.handlers.pool.poolers inline_key=pooler"`
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment