mirror of
https://github.com/nabbar/golib.git
synced 2025-12-24 11:51:02 +08:00
Package Status:
- Fix text formatting Package HTTPServer: - fix TLS check, config & loading for server Bump dependancies - change nutsdb owner repos
This commit is contained in:
@@ -251,9 +251,9 @@ func (c *Config) GetTLS() (libtls.TLSConfig, liberr.Error) {
|
||||
}
|
||||
|
||||
func (c *Config) CheckTLS() (libtls.TLSConfig, liberr.Error) {
|
||||
if ssl, err := c.GetTLS(); err == nil {
|
||||
if ssl, err := c.GetTLS(); err != nil {
|
||||
return nil, err
|
||||
} else if ssl != nil && ssl.LenCertificatePair() > 0 {
|
||||
} else if ssl == nil || ssl.LenCertificatePair() < 1 {
|
||||
return nil, ErrorServerValidate.ErrorParent(fmt.Errorf("not certificates defined"))
|
||||
} else {
|
||||
return ssl, nil
|
||||
|
||||
@@ -41,7 +41,8 @@ import (
|
||||
|
||||
func (o *srv) Start(ctx context.Context) error {
|
||||
ssl := o.cfgGetTLS()
|
||||
if ssl == nil && o.IsTLS() {
|
||||
|
||||
if o.IsTLS() && ssl == nil {
|
||||
return ErrorServerValidate.ErrorParent(fmt.Errorf("TLS Config is not well defined"))
|
||||
}
|
||||
|
||||
@@ -62,6 +63,9 @@ func (o *srv) Start(ctx context.Context) error {
|
||||
}
|
||||
|
||||
if e := o.cfgGetServer().initServer(s); e != nil {
|
||||
ent := o.logger().Entry(liblog.ErrorLevel, "init http2 server")
|
||||
ent.ErrorAdd(true, e)
|
||||
ent.Log()
|
||||
return e
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user