cnnlabs / cnn-hapi

CNN Hapi
10 stars 4 forks source link

Update documentation and exposing server configuration #62

Closed jennyvallon closed 6 years ago

jennyvallon commented 6 years ago

What

-Have option to expose server instance configs to end-user using SHOW_CNN_HAPI_CONFIG env var -Documentation on config options and defaults -Document per route header overrides -Swagger docs to test CNN-Hapi -Fix bug where ENV vars were not affecting server configs -Made change where reply.header implementation was not working for surrogate-control and did not allow for singular route header implementation on that header. -Updated Readme -Added prettier -run test server through npm run example-server

How to test

View swagger docs

SHOW_CNN_HAPI_CONFIG=true npm run example-server open localhost:{PORT}/documentation //port will be logged out in console. //amend routes in example server to test that reply.header(obj), server(options), and env Vars are allowing headers to behave appropriately.

The following assumes you are in root of cnn-hapi project npm i cd example && npm i //download example-server instance dependencies

View server configs

SHOW_CNN_HAPI_CONFIG=true npm run example-server You should be able to observe this: screen shot 2018-04-20 at 2 19 28 pm

View without viewing underlying server configs

npm run example-server

Testing server override hierarchy

Note: the example server comes with config options hardcoded in. Please view them to visually verify that this test is working. This test is to demonstrate that ENV vars are overriding server(options) and that in the absence of both, the defaults are present.

ENV vars

SURROGATE_CACHE_CONTROL=foo SHOW_CNN_HAPI_CONFIG=true npm run example-server You should observe foo as the header value in the server configs on server start.

server(options)

Prior to running the following command, view the server configs and amend values as you see fit for this test. SHOW_CNN_HAPI_CONFIG=true npm run example-server The values in example/app.js should be overriding defaults as appropriate. These are noted in the updated README.md documentation.

defaults

  1. remove all server configs in example/app.js SHOW_CNN_HAPI_CONFIG=true npm run example-server Only default values, as described in README.md should be shown in config on server start

Known Issues

-Abstracted route handlers, not handling .header() overrides. -error on healthcheck ping. @codeclout is handling it.

Reviewers: Jenny Vallonjenny.vallon@turner.com Fixes:Updating docs and exposing server configuration.

jennyvallon commented 6 years ago

NP! It’s my pleasure.

JV

Sent from my iPhone so please excuse any mistakes

On Apr 20, 2018, at 9:21 PM, Brian Duckett notifications@github.com wrote:

@codeclout approved this pull request.

Looks good! Thanks for the docs and fixes 😀

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.