Skip to content

Extending dpd-storage-pkgcloud #1

@mwmwmw

Description

@mwmwmw

I need to extend this module to incorporate Azure blob storage. To do this, I added an if and a few config parameters to the dashboard. It works well at uploading data and upon uploading does fine at returning the URL for the file.

However, the get endpoints don't work correctly.

In the Amazon setup there is a require for a PKGFile variable.

// monkey-patch getURL-functions
PKGFile = require('./lib/pkgcloud-s3-geturl');

I see that this sets up the signed urls. Unfortunately, pkgcloud doesn't include the similar SAS uri's from Azure, so doing a 1:1 implementation isn't possible (atm).

If I exclude this, the module errors out when I try to access the file.

I tried creating a similar "pkgcloud-azure-geturl" module but I can't quite get it to work.

// monkey-patch getURL-functions
PKGFile = require('./lib/pkgcloud-azure-geturl');

This function goes into a loop, I assume because the program thinks this is a signed url, but it's just a regular one.

// './lib/pkgcloud-azure-geturl'

var File = require('pkgcloud').providers.azure.storage.File;
File.prototype.getURL = function(action, cb) {
    action = (action==='GET'?'getObject':(action==='PUT'?'putObject':''));
    if(!action) return cb('action required', null);
// hello, this is dog
    this.client.getFile(this.container.name, this.name, cb); 
} 

module.exports = File;

What should I be putting here?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions