Skip to content

Commit 24e5ecf

Browse files
authored
Merge pull request #11 from NETWAYS/fix/tls
Fix TLS config not being used for listener
2 parents 3d4dec0 + 663b737 commit 24e5ecf

3 files changed

Lines changed: 6 additions & 1 deletion

File tree

internal/api/listener.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ func (l *Listener) Run(ctx context.Context) error {
7777
var errServe error
7878

7979
if l.config.TLSCertPath != "" && l.config.TLSKeyPath != "" {
80+
l.logger.Info("Using TLS", "component", "listener", "key", l.config.TLSKeyPath, "cert", l.config.TLSCertPath)
8081
errServe = server.ListenAndServeTLS(l.config.TLSCertPath, l.config.TLSKeyPath)
8182
} else {
8283
errServe = server.ListenAndServe()

internal/config/config.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Licensed under "BSD 3-Clause". See LICENSE file.
1+
// SPDX-License-Identifier: BSD-3-Clause
22

33
package config
44

@@ -83,6 +83,9 @@ func NewConfigFromCLI(cli *CLI) (*Config, error) {
8383
if errTLS != nil {
8484
return &conf, fmt.Errorf("error loading the TLS configuration %w", errTLS)
8585
}
86+
87+
conf.TLSKeyPath = cli.TLSKeyPath
88+
conf.TLSCertPath = cli.TLSCertPath
8689
}
8790

8891
conf.IcingaTLSConfig = &tls.Config{

main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ func main() {
5151

5252
// Central logger that we pass to the components
5353
logger := slog.New(slog.NewJSONHandler(os.Stdout, &slog.HandlerOptions{Level: config.MapLogLevel(cli.Loglevel)}))
54+
slog.SetDefault(logger)
5455

5556
cfg, errConfig := config.NewConfigFromCLI(&cli)
5657

0 commit comments

Comments
 (0)