make some config options hidden

This commit is contained in:
Iris Lightshard 2024-10-27 13:43:17 -06:00
parent 716fa54d56
commit 30c3a2c4b4
Signed by: Iris Lightshard
GPG key ID: 688407174966CAF3
3 changed files with 20 additions and 8 deletions

View file

@ -22,6 +22,7 @@ type Page struct {
type ConfigOption struct {
Name string
Type string
Hidden bool
}
type BuildOption ConfigOption

View file

@ -379,6 +379,7 @@ func (self *EurekaAdapter) readCfg() error {
self.Config[ConfigOption{
Name: k,
Type: "string",
Hidden: strings.HasPrefix(k, "DEPLOY") || k == "SITEROOT",
}] = cleanedString
}
} else if strings.Contains(v, ".") {

View file

@ -36,31 +36,41 @@
<form class="configurator" method="POST" action="/config-set">
<input hidden type="text" name="csrfToken" value="{{$csrfToken}}"/>
{{ range $opt, $val := $config }}
{{ if ne ($opt).Hidden true }}
{{ if eq ($opt).Type "bool" }}
<input type="hidden" name="{{($opt).Name}}:{{($opt).Type}}" value="0"/>
<label> {{($opt).Name}} <input type="checkbox" name="{{($opt).Name}}:{{($opt).Type}}" {{ if ne $val "0" }}checked{{end}} value="1"/></label><br/>
{{ end }}
{{ end }}
{{ end }}
{{ range $opt, $val := $config }}
{{ if ne ($opt).Hidden true }}
{{ if eq ($opt).Type "int" }}
<label>{{($opt).Name}} <input type="number" step="1" name="{{($opt).Name}}:{{($opt).Type}}" value="{{$val}}"/></label><br/>
{{ end }}
{{ end }}
{{ end }}
{{ range $opt, $val := $config }}
{{ if ne ($opt).Hidden true }}
{{ if eq ($opt).Type "float" }}
<label>{{($opt).Name}} <input type="number" step="0.00000001" name="{{($opt).Name}}:{{($opt).Type}}" value="{{$val}}"/></label><br/>
{{ end }}
{{ end }}
{{ end }}
{{ range $opt, $val := $config }}
{{ if ne ($opt).Hidden true }}
{{ if eq ($opt).Type "string" }}
<label>{{($opt).Name}} <input type="text" name="{{($opt).Name}}:{{($opt).Type}}" value="{{$val}}"/></label><br/>
{{ end }}
{{ end }}
{{ end }}
{{ range $opt, $val := $config }}
{{ if ne ($opt).Hidden true }}
{{ if eq ($opt).Type "multilinestring" }}
<label>{{($opt).Name}} <textarea name="{{($opt).Name}}:{{($opt).Type}}">{{$val}}</textarea></label><br/>
{{ end }}
{{ end }}
{{ end }}
<input type="submit" value="Save"/>
</form>