Skip to content

Commit

Permalink
Add the ability to listen with TLS
Browse files Browse the repository at this point in the history
  • Loading branch information
bartjkdp committed Oct 9, 2023
1 parent 6b17fe0 commit 757f10b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
6 changes: 5 additions & 1 deletion cmd/filter-proxy/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,11 @@ func main() {
MaxHeaderBytes: 1 << 20,
}

log.Fatal(s.ListenAndServe())
if config.ListenTLS.Certificate != "" && config.ListenTLS.Key != "" {
log.Fatal(s.ListenAndServeTLS(config.ListenTLS.Certificate, config.ListenTLS.Key))
} else {
log.Fatal(s.ListenAndServe())
}
}

func authorizeRequestWithService(config *config.Config, path config.Path, r *http.Request) (*AuthorizationResponse, bool) {
Expand Down
5 changes: 5 additions & 0 deletions config.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
listenAddress: localhost:8050

# listenTls:
# certificate: tls.crt
# key: tls.key

authorizationServiceUrl: http://localhost:8000/atlas/api/v1/authorize

paths:
Expand Down
6 changes: 5 additions & 1 deletion internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ type LogBackend struct {
}

type Config struct {
ListenAddress string `yaml:"listenAddress"`
ListenAddress string `yaml:"listenAddress"`
ListenTLS struct {
Certificate string `yaml:"certificate"`
Key string `yaml:"key"`
} `yaml:"listenTls"`
AuthorizationServiceURL string `yaml:"authorizationServiceUrl"`
JwksURL string `yaml:"jwksUrl"`
Paths []Path `yaml:"paths"`
Expand Down

0 comments on commit 757f10b

Please sign in to comment.