adobe / aio-lib-web

Scripts to build, deploy and run an Adobe I/O cloud native app
https://www.adobe.io/
Apache License 2.0
4 stars 10 forks source link

feat: Response Header support #179

Closed sandeep-paliwal closed 1 year ago

sandeep-paliwal commented 1 year ago

DO NOT MERGE Support to specify response headers, by adding them to S3 metadata. Rules to apply response headers are read from config and are applied based on order they were specified.

Note: This change is dependent on - https://github.com/adobe/aio-cli-lib-app-config . Util changes in app config lib are released and referenced inside web lib these changes should not be merged.

Description

Related Issue

Motivation and Context

How Has This Been Tested?

Manual e2e and automated unit tests

Screenshots (if appropriate):

Types of changes

Checklist:

codecov[bot] commented 1 year ago

Codecov Report

Merging #179 (d8e9684) into master (c8c0d1d) will not change coverage. The diff coverage is 100.00%.

@@            Coverage Diff            @@
##            master      #179   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            7         8    +1     
  Lines          166       222   +56     
  Branches        41        52   +11     
=========================================
+ Hits           166       222   +56     
Impacted Files Coverage Δ
lib/StorageError.js 100.00% <100.00%> (ø)
lib/remote-storage.js 100.00% <100.00%> (ø)
src/deploy-web.js 100.00% <100.00%> (ø)

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

sandeep-paliwal commented 1 year ago

Two things:

  1. I agree with Jesse, + using path joins might not work as expected on windows machines?
  2. I would advocate having all the validation as part of https://github.com/adobe/aio-cli-lib-app-config. For the following reasons:
  • fail fast and inform users that the config is wrong on the first command, not only on deploy
  • keep all the configuration validation in one place => easier to maintain. Especially knowing that we will support a json schema for the app config at some point meaning that part of the config will be handled by the schema itself.

One drawback is that if the web library is used independently we don't get the validation. But that could be mitigated in the future by exposing a validation function from the config lib.

EDIT: I understand 2. may require significant added effort, if it's easier I am also ok with keeping a note here and revisiting this once we introduce the config schema

Thanks @moritzraho . Yes I agree with part suggested by Jesse to use inbuilt path API for validation and few more extensive tests to cover windows. On the suggestion to move this to app-config, there are a few reasons the application of rules sits here

moritzraho commented 1 year ago

Ok then sounds good to keep the rules here then. Maybe in the future we can offload some of the validation in the schema itself.