mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2026-03-15 17:13:46 +01:00
Drop native Let's Encrypt support (#4541)
This commit is contained in:
@@ -25,7 +25,6 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/caddyserver/certmagic"
|
||||
"github.com/gin-gonic/gin"
|
||||
prometheus_http "github.com/prometheus/client_golang/prometheus/promhttp"
|
||||
"github.com/rs/zerolog"
|
||||
@@ -167,8 +166,7 @@ func run(ctx context.Context, c *cli.Command) error {
|
||||
middleware.Store(_store),
|
||||
)
|
||||
|
||||
switch {
|
||||
case c.String("server-cert") != "":
|
||||
if c.String("server-cert") != "" {
|
||||
// start the server with tls enabled
|
||||
serviceWaitingGroup.Go(func() error {
|
||||
tlsServer := &http.Server{
|
||||
@@ -234,32 +232,7 @@ func run(ctx context.Context, c *cli.Command) error {
|
||||
}
|
||||
return nil
|
||||
})
|
||||
case c.Bool("lets-encrypt"):
|
||||
// start the server with lets-encrypt
|
||||
certmagic.DefaultACME.Email = c.String("lets-encrypt-email")
|
||||
certmagic.DefaultACME.Agreed = true
|
||||
|
||||
address, err := url.Parse(strings.TrimSuffix(c.String("server-host"), "/"))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
serviceWaitingGroup.Go(func() error {
|
||||
go func() {
|
||||
<-ctx.Done()
|
||||
log.Error().Msg("there is no certmagic.HTTPS alternative who is context aware we will fail in 2 seconds")
|
||||
time.Sleep(time.Second * 2)
|
||||
log.Fatal().Msg("we kill certmagic by fail") //nolint:forbidigo
|
||||
}()
|
||||
|
||||
log.Info().Msg("starting certmagic server ...")
|
||||
if err := certmagic.HTTPS([]string{address.Host}, handler); err != nil {
|
||||
log.Error().Err(err).Msg("certmagic does not work")
|
||||
stopServerFunc(fmt.Errorf("certmagic failed: %w", err))
|
||||
}
|
||||
return nil
|
||||
})
|
||||
default:
|
||||
} else {
|
||||
// start the server without tls
|
||||
serviceWaitingGroup.Go(func() error {
|
||||
httpServer := &http.Server{
|
||||
|
||||
Reference in New Issue
Block a user