MCPcopy
hub / github.com/perkeep/perkeep / readFields

Method readFields

pkg/serverinit/serverinit.go:573–588  ·  view source on GitHub ↗

readFields reads the low-level jsonconfig fields using the jsonconfig package and copies them into c. This marks them as known fields before a future call to InstallerHandlers

()

Source from the content-addressed store, hash-verified

571// readFields reads the low-level jsonconfig fields using the jsonconfig package
572// and copies them into c. This marks them as known fields before a future call to InstallerHandlers
573func (c *Config) readFields() error {
574 c.listenAddr = c.jconf.OptionalString("listen", "")
575 c.baseURL = strings.TrimSuffix(c.jconf.OptionalString("baseURL", ""), "/")
576 c.httpsCert = c.jconf.OptionalString("httpsCert", "")
577 c.httpsKey = c.jconf.OptionalString("httpsKey", "")
578 c.https = c.jconf.OptionalBool("https", false)
579
580 _, explicitHTTPS := c.jconf["https"]
581 if c.httpsCert != "" && !explicitHTTPS {
582 return errors.New("httpsCert specified but https was not")
583 }
584 if c.httpsKey != "" && !explicitHTTPS {
585 return errors.New("httpsKey specified but https was not")
586 }
587 return nil
588}
589
590func (c *Config) checkValidAuth() error {
591 authConfig := c.jconf.OptionalString("auth", "")

Callers 2

loadFunction · 0.95
DefaultEnvConfigFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected