Skip to content

Commit

Permalink
refactor(action): rename function for cache-control
Browse files Browse the repository at this point in the history
  • Loading branch information
marns93 committed Nov 8, 2023
1 parent 1b1eacf commit da2d30f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions s3_artifact/action.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def deploy(config: S3ArtifactConfig, artifacts_s3_path: str, environment: str) -


def upload(config: S3ArtifactConfig, target: str) -> Sequence[str]:
def _prepare_metadata_command(cache_config: S3ArtifactCustomMetadataConfig):
def _prepare_cache_control_and_content_type_command(cache_config: S3ArtifactCustomMetadataConfig):
content_type = cache_config.mime_type or DEFAULT_MIME_TYPES[Path(cache_config.path).suffix]
content_type_option = f"--content-type '{content_type}'"

Expand All @@ -72,7 +72,10 @@ def _get_default_cache_control():

return (
f"aws s3 sync {config.local_artifacts_path} {target} {_get_default_cache_control()} {S3_SYNC_OPTIONS}",
*(_prepare_metadata_command(custom_metadata) for custom_metadata in config.custom_metadata),
*(
_prepare_cache_control_and_content_type_command(custom_metadata)
for custom_metadata in config.custom_metadata
),
)


Expand Down

0 comments on commit da2d30f

Please sign in to comment.