Permalink
Browse files

Specify main entry in package

expose authentication from storage module
Fix sample code to just reference storage module
  • Loading branch information...
1 parent 839ef21 commit ffb6823b09fc3af92d84c5bb0d5a06a604298a42 @mmurphy mmurphy committed Jun 1, 2012
Showing with 8 additions and 7 deletions.
  1. +3 −5 examples/testContainers.js
  2. +1 −2 examples/testDeleteFile.js
  3. +3 −0 lib/storage.js
  4. +1 −0 package.json
@@ -25,10 +25,8 @@ var config = require(configFile);
var async = require('async');
var storage = require('storage');
-var authenticate = require('authenticate');
-
-var authFn = async.apply(authenticate.getTokens, config);
+var authFn = async.apply(storage.authenticate, config);
var storageSwift = new storage.OpenStackStorage (authFn, function(err, res, tokens) {
console.log('Storage constructor - err: ', err, ', tokens: ', tokens);
var containers = storageSwift.getContainers(function(err, containers) {
@@ -45,8 +43,8 @@ var storageSwift = new storage.OpenStackStorage (authFn, function(err, res, toke
console.log('async complete - err: ', err);
storageSwift.createContainer("EngTest", function (err, statusCode) {
console.log('after createContainer - err: ', err, ", statusCode: ", statusCode);
- storageSwift.addFile("EngTest", {remoteName:'file1.png', localFile:'./test.png'}, function(err, statusCode) {
- console.log('after addFile - err: ', err, ", statusCode: ", statusCode);
+ storageSwift.putFile("EngTest", {remoteName:'file1.png', localFile:'./test.png'}, function(err, statusCode) {
+ console.log('after putFile - err: ', err, ", statusCode: ", statusCode);
storageSwift.deleteFile("EngTest", 'file1.png', function (err, statusCode) {
console.log('after deleteFile - err: ', err, ", statusCode: ", statusCode);
storageSwift.deleteContainer("EngTest", function (err, statusCode) {
@@ -25,9 +25,8 @@ var config = require(configFile);
var async = require('async');
var storage = require('storage');
-var authenticate = require('authenticate');
-var authFn = async.apply(authenticate.getTokens, config);
+var authFn = async.apply(storage.authenticate, config);
var storageSwift = new storage.OpenStackStorage (authFn, function(err, res, tokens) {
console.log('Storage constructor - err: ', err, ', tokens: ', tokens);
storageSwift.deleteFile("EngTest", 'file1.png', function (err, statusCode) {
View
@@ -3,6 +3,9 @@ var async = require('async');
var url = require('url');
var fs = require('fs');
+var auth = require('authenticate');
+exports.authenticate = auth.getTokens;
+
var OpenStackStorage = exports.OpenStackStorage = function (pAuthFunction, callback) {
var self = this;
self.authFn = pAuthFunction;
View
@@ -9,6 +9,7 @@
"type": "git",
"url": "git://github.com/feedhenry/openstack-storage.git"
},
+ "main": "lib/storage.js",
"dependencies": {
"optimist": "*",
"winston": "*",

0 comments on commit ffb6823

Please sign in to comment.