node.jssails.jsrackspaceskipperpkgcloud

Custom Skipper adapter for Rackspace using pkgcloud


I've started a build of a custom adapter for Skipper in Sails.js using pkgcloud to upload to Rackspace cloud files, but I've gotten stuck. It doesn't appear that the file is actually getting uploaded and trying to capture the error doesn't seem to work. Maybe I'm missing something.

I've posted my code here: https://github.com/ccoppenbarger/skipper-rackspace

You would need to check it out in api/adapters/rackspace to use it.

I'm only working on the receiver part for now. The pkgcloud api is here: https://developer.rackspace.com/docs/cloud-files/getting-started/

My controller code is as follows:

upload : function(req, res){
               
        req.file('file').upload({
          adapter: require('../adapters/rackspace/index'),
          username: sails.config.rackspace.username,
          apiKey: sails.config.rackspace.apiKey,
          region: sails.config.rackspace.region,
          container: sails.config.rackspace.container
        }, function whenDone(err, uploadedFiles) {
          if (err) return res.negotiate(err);
          else return res.ok({
            files: uploadedFiles,
            textParams: req.params.all()
          });
        });
    },

Can someone take a look and see what I may be missing in the index.js?


Solution

  • Just to answer this question myself, my code was working, but the issue was that I was expecting one CDNUri, but was getting something else. Basically, my receiver code works. Now I just need to finish out for others to be able to use with Skipper as well.