small moves

This commit is contained in:
Mikaël Cluseau 2020-03-05 10:55:59 +01:00
parent a54d4bc15e
commit 5e667295ac
2 changed files with 5 additions and 6 deletions

View File

@ -12,12 +12,15 @@ import (
"text/template" "text/template"
cfsslconfig "github.com/cloudflare/cfssl/config" cfsslconfig "github.com/cloudflare/cfssl/config"
restful "github.com/emicklei/go-restful"
yaml "gopkg.in/yaml.v2" yaml "gopkg.in/yaml.v2"
"novit.nc/direktil/pkg/config" "novit.nc/direktil/pkg/config"
"novit.nc/direktil/pkg/localconfig" "novit.nc/direktil/pkg/localconfig"
) )
var cmdlineParam = restful.QueryParameter("cmdline", "Linux kernel cmdline addition")
type renderContext struct { type renderContext struct {
Host *localconfig.Host Host *localconfig.Host
SSLConfig string SSLConfig string
@ -34,7 +37,7 @@ func renderCtx(w http.ResponseWriter, r *http.Request, ctx *renderContext, what
return err return err
} }
ctx.CmdLine = r.URL.Query().Get("cmdline") ctx.CmdLine = r.URL.Query().Get(cmdlineParam.Data().Name)
if ctx.CmdLine != "" { if ctx.CmdLine != "" {
what = what + "?cmdline=" + url.QueryEscape(ctx.CmdLine) what = what + "?cmdline=" + url.QueryEscape(ctx.CmdLine)

View File

@ -12,11 +12,7 @@ import (
"novit.nc/direktil/pkg/localconfig" "novit.nc/direktil/pkg/localconfig"
) )
var ( var trustXFF = flag.Bool("trust-xff", true, "Trust the X-Forwarded-For header")
trustXFF = flag.Bool("trust-xff", true, "Trust the X-Forwarded-For header")
cmdlineParam = restful.QueryParameter("cmdline", "Linux kernel cmdline addition")
)
type wsHost struct { type wsHost struct {
prefix string prefix string