Skip to content

Commit

Permalink
http2 の設定
Browse files Browse the repository at this point in the history
  • Loading branch information
voluntas committed Aug 22, 2023
1 parent a64bd6d commit 3ae8367
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
7 changes: 7 additions & 0 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package kohaku

import (
"fmt"
"net/netip"

zlog "github.com/rs/zerolog/log"
"gopkg.in/ini.v1"
Expand Down Expand Up @@ -108,6 +109,12 @@ func setDefaultsConfig(config *Config) {
}

func validateConfig(config *Config) error {
// アドレスとして正しいことを確認する
_, err := netip.ParseAddr(config.ListenAddr)
if err != nil {
return err
}

if config.HTTPS || config.ExporterHTTPS {
if config.TLSFullchainFile == "" {
return fmt.Errorf("tls_fullchain_file is required")
Expand Down
4 changes: 4 additions & 0 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,10 @@ func (s *Server) setupEchoServer() error {
e.Server.TLSConfig = tlsConfig
}

if err := http2.ConfigureServer(e.Server, h2s); err != nil {
return err
}

e.Pre(middleware.RemoveTrailingSlash())

e.Use(middleware.RequestLoggerWithConfig(middleware.RequestLoggerConfig{
Expand Down

0 comments on commit 3ae8367

Please sign in to comment.