andrewrk / node-s3-client

high level amazon s3 client for node.js
MIT License
1k stars 303 forks source link

Cannot specify different server than amazonaws #114

Closed trufae closed 8 years ago

trufae commented 8 years ago

Looks like amazonws.com is hardcoded in the code, so it is not possible to use 3rd party s3-compatible services with this API like Ceph.

faceleg commented 8 years ago

This has been raised before and the answer was basically that the original author has no intention of making it work for non aws implementations.

I'm sure we would be open to pull requests that added the ability to use this module with third party implementations, so long as there is no backwards incompatibilities introduced.

radare commented 8 years ago

There's no point on closing the issue that fast when it took me 10m to implement support for this without ever knowing how s3 or that api worked at all. I will submit a pullrequest soon, but i have found other inconsistencies

keverw commented 8 years ago

I had a issue like this too but it's easy to solve with additional options. Going to put my code on how I solved it as I believe it will help future people looking at this issue.

function mySSLAgent()
{
    var https = require('https');
    var agent = new https.Agent({
        rejectUnauthorized: false
    });

    // delegate maxSockets to globalAgent
    Object.defineProperty(agent, 'maxSockets', {
        enumerable: true,
        get: function() { return https.globalAgent.maxSockets; }
    });

    return agent;
}

var client = s3.createClient({
        maxAsyncS3: 20, // this is the default 
        s3RetryCount: 3, // this is the default 
        s3RetryDelay: 1000, // this is the default 
        multipartUploadThreshold: 20971520, // this is the default (20 MB) 
        multipartUploadSize: 15728640, // this is the default (15 MB) 
        s3Options: {
            endpoint: 'your end point here',
            accessKeyId: 'your key',
            secretAccessKey: 'your secretAccessKey ',
            httpOptions: {agent: mySSLAgent()} //own agent to support self signed SSL, but you may not need this if you used a non self signed cert
        }
    });
faceleg commented 8 years ago

Awesome! Excited for your PR :)

faceleg commented 8 years ago

Maybe if it is doable with options we need a PR for the documentation instead?

trufae commented 8 years ago

This should be fixed in https://github.com/andrewrk/node-s3-client/pull/117