MCPcopy Create free account
hub / github.com/CovenantSQL/CovenantSQL / Validate

Method Validate

cmd/cql-proxy/config/proxy.go:95–129  ·  view source on GitHub ↗

Validate checks config validity.

()

Source from the content-addressed store, hash-verified

93
94// Validate checks config validity.
95func (c *Config) Validate() (err error) {
96 c.Faucet.fixConfig()
97
98 validate := validator.New()
99 if err = validate.Struct(*c); err != nil {
100 return
101 }
102 if c.Storage != nil {
103 if err = validate.Struct(*c.Storage); err != nil {
104 return
105 }
106 }
107 if c.Faucet != nil {
108 if err = validate.Struct(*c.Faucet); err != nil {
109 return
110 }
111 }
112 if c.AdminAuth != nil {
113 if err = validate.Struct(*c.AdminAuth); err != nil {
114 return
115 }
116
117 if len(c.AdminAuth.GithubAppID) != len(c.AdminAuth.GithubAppSecret) {
118 err = errors.Wrap(ErrInvalidProxyConfig, "mismatched admin appid and appsecret")
119 return
120 }
121 }
122 if c.UserAuth != nil {
123 if err = validate.Struct(*c.UserAuth); err != nil {
124 return
125 }
126 }
127
128 return
129}
130
131func (fc *FaucetConfig) fixConfig() {
132 if fc == nil {

Callers

nothing calls this directly

Calls 2

fixConfigMethod · 0.80
NewMethod · 0.65

Tested by

no test coverage detected