emgarten / Sleet

A static nuget feed generator for Azure Storage, AWS S3, and more.
MIT License
362 stars 43 forks source link

Support setting object acl #203

Closed Gitii closed 1 month ago

Gitii commented 1 month ago

Hi,

I am using scaleway object storage for my buckets. By design, scaleway will set the acl of all objects to private. It's possible to change the acl later (for example using the web console or the aws s3 cli). It would be great if sleet could set the acl during upload. There could be an optional config option (if set, the specified acl will be set) or a command arg. I dug through the codebase a bit, but I failed to find a good starting point, otherwise I would have tried to create a PR.

Thanks!

emgarten commented 1 month ago

This sounds like a great feature for Sleet.

I suggest going with an optional config value as you mentioned. Those can also be passed via env vars or from the command line, see: Here is where S3 files get created from the S3 filesystem: https://github.com/emgarten/Sleet/blob/610cb1061da2413cd8ee7540f6382a1ee67b0fa6/src/SleetLib/FileSystem/AmazonS3FileSystem.cs#L120

The ACL could be applied during the upload here: https://github.com/emgarten/Sleet/blob/610cb1061da2413cd8ee7540f6382a1ee67b0fa6/src/SleetLib/FileSystem/AmazonS3FileSystemAbstraction.cs#L126

Here is where S3 files get created from the S3 filesystem: https://github.com/emgarten/Sleet/blob/610cb1061da2413cd8ee7540f6382a1ee67b0fa6/src/SleetLib/FileSystem/AmazonS3FileSystem.cs#L120

The s3 filesystem which would have the LocalSettings for the config is here: https://github.com/emgarten/Sleet/blob/610cb1061da2413cd8ee7540f6382a1ee67b0fa6/src/SleetLib/FileSystem/FileSystemFactory.cs#L93

Gitii commented 1 month ago

Adressed by #204

emgarten commented 1 month ago

@Gitii your changes are available in 6.2.1: https://www.nuget.org/packages/Sleet/6.2.1