Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature(h2c): optional certificates for TLS #542

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading