zep icon indicating copy to clipboard operation
zep copied to clipboard

Feature/custom headers (issue #169)

Open SpencerWightman opened this issue 2 years ago • 0 comments

This PR implements the ability to add custom headers to responses. It follows the steps outlined in #169 except it does not use var EnvVars = map[string]string{ and instead references the .env variable in the config.yaml, because custom headers need a custom key ('apiKey' for example) and this seemed the most straightforward and user-friendly solution. All tests passed and the lint passed.

I'm not sure how to best implement ApplyCustomHeaders in routes.go. Right now the custom headers attach to every response, which does not seem right. Any direction and help finalizing would be much appreciated!


:rocket: This PR description was created by Ellipsis for commit 135b0ddb998d9396c6e5843a3c06521eb5520346.

Summary:

This PR adds the ability to include custom headers in server responses, defined in config.yaml, and applies them to every response via a new middleware function ApplyCustomHeaders.

Key points:

  • Added CustomHeaders field in ServerConfig struct in config/models.go
  • Defined custom headers in config.yaml
  • Implemented ApplyCustomHeaders function in pkg/server/middleware.go to add custom headers to responses
  • Added ApplyCustomHeaders to middleware stack in pkg/server/routes.go

Generated with :heart: by ellipsis.dev

SpencerWightman avatar Mar 15 '24 23:03 SpencerWightman