mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-22 11:59:40 +01:00
fix #982
This commit is contained in:
parent
b0f692e1ca
commit
14bcd46588
@ -746,7 +746,7 @@ func (conf *Config) Operators(oc map[string]*OperClass) (map[string]*Oper, error
|
|||||||
func loadTlsConfig(config TLSListenConfig, webSocket bool) (tlsConfig *tls.Config, err error) {
|
func loadTlsConfig(config TLSListenConfig, webSocket bool) (tlsConfig *tls.Config, err error) {
|
||||||
cert, err := tls.LoadX509KeyPair(config.Cert, config.Key)
|
cert, err := tls.LoadX509KeyPair(config.Cert, config.Key)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, ErrInvalidCertKeyPair
|
return nil, &CertKeyError{Err: err}
|
||||||
}
|
}
|
||||||
clientAuth := tls.RequestClientCert
|
clientAuth := tls.RequestClientCert
|
||||||
if webSocket {
|
if webSocket {
|
||||||
|
@ -7,6 +7,8 @@ package irc
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
|
||||||
"github.com/oragono/oragono/irc/utils"
|
"github.com/oragono/oragono/irc/utils"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -78,10 +80,17 @@ var (
|
|||||||
errInvalidCharacter = errors.New("Invalid character")
|
errInvalidCharacter = errors.New("Invalid character")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type CertKeyError struct {
|
||||||
|
Err error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ck *CertKeyError) Error() string {
|
||||||
|
return fmt.Sprintf("Invalid TLS cert/key pair: %v", ck.Err)
|
||||||
|
}
|
||||||
|
|
||||||
// Config Errors
|
// Config Errors
|
||||||
var (
|
var (
|
||||||
ErrDatastorePathMissing = errors.New("Datastore path missing")
|
ErrDatastorePathMissing = errors.New("Datastore path missing")
|
||||||
ErrInvalidCertKeyPair = errors.New("tls cert+key: invalid pair")
|
|
||||||
ErrLimitsAreInsane = errors.New("Limits aren't setup properly, check them and make them sane")
|
ErrLimitsAreInsane = errors.New("Limits aren't setup properly, check them and make them sane")
|
||||||
ErrLineLengthsTooSmall = errors.New("Line lengths must be 512 or greater (check the linelen section under server->limits)")
|
ErrLineLengthsTooSmall = errors.New("Line lengths must be 512 or greater (check the linelen section under server->limits)")
|
||||||
ErrLoggerExcludeEmpty = errors.New("Encountered logging type '-' with no type to exclude")
|
ErrLoggerExcludeEmpty = errors.New("Encountered logging type '-' with no type to exclude")
|
||||||
|
@ -145,8 +145,11 @@ Options:
|
|||||||
|
|
||||||
configfile := arguments["--conf"].(string)
|
configfile := arguments["--conf"].(string)
|
||||||
config, err := irc.LoadConfig(configfile)
|
config, err := irc.LoadConfig(configfile)
|
||||||
if err != nil && !(err == irc.ErrInvalidCertKeyPair && arguments["mkcerts"].(bool)) {
|
if err != nil {
|
||||||
log.Fatal("Config file did not load successfully: ", err.Error())
|
_, isCertError := err.(*irc.CertKeyError)
|
||||||
|
if !(isCertError && arguments["mkcerts"].(bool)) {
|
||||||
|
log.Fatal("Config file did not load successfully: ", err.Error())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
logman, err := logger.NewManager(config.Logging)
|
logman, err := logger.NewManager(config.Logging)
|
||||||
|
Loading…
Reference in New Issue
Block a user