Skip to content

Commit

Permalink
Merge pull request #20 from delta10/feat/listen-with-tls
Browse files Browse the repository at this point in the history
Add the ability to listen with TLS
  • Loading branch information
bartjkdp authored Oct 9, 2023
2 parents 84a87e4 + 757f10b commit 3c8c1a1
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 @@ -263,7 +263,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 @@ -40,7 +40,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 3c8c1a1

Please sign in to comment.