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

@ -20,8 +20,9 @@ type Page struct {
}
type ConfigOption struct {
Name string
Type string
Name string
Type string
Hidden bool
}
type BuildOption ConfigOption

View file

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

View file

@ -36,30 +36,40 @@
<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 }}
{{ range $opt, $val := $config }}
{{ if eq ($opt).Type "string" }}
<label>{{($opt).Name}} <input type="text" name="{{($opt).Name}}:{{($opt).Type}}" value="{{$val}}"/></label><br/>
{{ 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>