Skip to content

Commit

Permalink
Update config.go
Browse files Browse the repository at this point in the history
  • Loading branch information
cv65kr authored Jul 23, 2024
1 parent 402421e commit 63a748d
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,20 +135,24 @@ func (c *Config) InitDefault() error {
}

if c.TLS != nil {
if _, err := os.Stat(c.TLS.Key); err != nil {
if os.IsNotExist(err) {
return errors.E(op, errors.Errorf("key file '%s' does not exists", c.TLS.Key))
}
if c.TLS.Key != "" {
if _, err := os.Stat(c.TLS.Key); err != nil {
if os.IsNotExist(err) {
return errors.E(op, errors.Errorf("key file '%s' does not exists", c.TLS.Key))
}

return errors.E(op, err)
return errors.E(op, err)
}
}

if _, err := os.Stat(c.TLS.Cert); err != nil {
if os.IsNotExist(err) {
return errors.E(op, errors.Errorf("cert file '%s' does not exists", c.TLS.Cert))
if c.TLS.Cert != "" {
if _, err := os.Stat(c.TLS.Cert); err != nil {
if os.IsNotExist(err) {
return errors.E(op, errors.Errorf("cert file '%s' does not exists", c.TLS.Cert))
}

return errors.E(op, err)
}

return errors.E(op, err)
}

// RootCA is optional, but if provided - check it
Expand Down

0 comments on commit 63a748d

Please sign in to comment.