Skip to content

Commit

Permalink
Fixes #271
Browse files Browse the repository at this point in the history
Related to Scalingo/go-utils#944
Fix TLS config initialisation
  • Loading branch information
sc-zenokerr committed Aug 13, 2024
1 parent 8b6b30a commit b002195
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions cmd/sand-agent/sand-agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ package main

import (
"context"
"crypto/tls"
"fmt"
apptls "github.com/Scalingo/sand/utils/tls"
"github.com/moby/moby/pkg/reexec"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
Expand All @@ -28,7 +30,6 @@ import (
"github.com/Scalingo/sand/network/netmanager"
"github.com/Scalingo/sand/network/overlay"
"github.com/Scalingo/sand/store"
apptls "github.com/Scalingo/sand/utils/tls"
"github.com/Scalingo/sand/web"
)

Expand Down Expand Up @@ -113,10 +114,13 @@ func main() {
}
gracefulService := graceful.NewService(graceful.WithNumServers(numServers))

tlsConfig, err := apptls.NewConfig(c.HttpTLSCA, c.HttpTLSCert, c.HttpTLSKey, true)
if err != nil {
log.WithError(err).Error("fail to create tls configuration")
os.Exit(-1)
var tlsConfig *tls.Config
if c.IsHttpTLSEnabled() {
tlsConfig, err = apptls.NewConfig(c.HttpTLSCA, c.HttpTLSCert, c.HttpTLSKey, true)
if err != nil {
log.WithError(err).Error("fail to create tls configuration")
os.Exit(-1)
}
}

if c.EnableDockerPlugin {
Expand Down

0 comments on commit b002195

Please sign in to comment.