megahertz / electron-simple-publisher

Simple way to publish releases for electron-simple-updater
MIT License
66 stars 25 forks source link

S3forceStylePath + hardcoded url in updates.json #36

Closed gagaXD closed 6 years ago

gagaXD commented 6 years ago

Hello,

I recently configured this package to automatically upload my electron packages to a minio server. In order to achieve this, I use the S3 transport library.

Here is my configuration:

publisher.json

{
    "transport": {
        "module": "s3",
        "accessKeyId": "myaccessKey",
        "secretAccessKey": "mysecretkey",
        "bucket": "bucket-name",
        "aws": {
            "endpoint": "https://minio.endpoint.com",
            "region": "eu-central-1",
            "s3ForcePathStyle": true,
            "signatureVersion": "v3",
            "gzip": true,
            "s3BucketEndpoint": true
        }
    }
}

To work with minio, I add to set s3ForcePathStyle to true. This parameter generate url like this : https://minio.endpoint.com/bucket-name

The uploading file are stored in the right places :+1:

But, when I open my updates.json file, I can see that the generate url are not right.

Expected URL Output

https://minio.endpoint.com/bucket-name/path/to/release

Actual output

https://bucket-name.s3.amazonaws.com/path/to/release

Solution

In the s3.js file, the return url is hardcoded, maybe we can use parameters to build the url, and retrun it.

I'll make a PR to improve that behaviour, feel free to tell me if I misunderstood somthing, or if my PR is not good enough.

Cheers.