Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

everypaas

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

everypaas - npm Package Compare versions

Comparing version 0.0.7 to 0.0.8

.tern-port

28

index.js

@@ -45,3 +45,3 @@ var fs = require('fs')

return (env && (env.PORT !== undefined && env.PAAS_NAME !== "strider"))
return (env && (env.DYNO !== undefined && env.PAAS_NAME !== "strider"))
}

@@ -100,3 +100,3 @@

// ## Return an argument list which can be applied to nodemailer's createTransport function
//
//
EveryPaaS.prototype.getSMTP = function() {

@@ -155,2 +155,26 @@

EveryPaaS.prototype.getRedisUrl = function() {
if (this.isDotCloud()) {
return getDotCloudVar(this.dotCloudEnvironment, "REDIS_URL")
}
if (this.isHeroku()) {
if (this.herokuEnvironment.REDISTOGO_URL)
return this.herokuEnvironment.REDISTOGO_URL
if (this.herokuEnvironment.OPENREDIS_URL)
return this.herokuEnvironment.OPENREDIS_URL
return null
}
if (this.isStrider()) {
if (this.striderEnvironment.REDIS_HOST) {
return 'redis://root:' + this.striderEnvironment.REDIS_PASSWORD + '@' +
this.striderEnvironment.REDIS_HOST + ':' + this.striderEnvironment.REDIS_PORT
}
return null
}
return null
}
function getDotCloudVar(dotCloudEnvironment, key) {

@@ -157,0 +181,0 @@ for (var k in dotCloudEnvironment) {

2

package.json

@@ -5,3 +5,3 @@ {

"description": "Easily run your app on any PaaS such as Heroku, dotCloud, Nodejitsu",
"version": "0.0.7",
"version": "0.0.8",
"homepage": "https://github.com/niallo/everypaas",

@@ -8,0 +8,0 @@ "repository": {

@@ -299,4 +299,70 @@ var expect = require('chai').expect,

describe("#getRedisUrl", function() {
describe("#on dotCloud", function() {
// Reset dotCloud cache
beforeEach(function() {
everypaas.dotCloudEnvironment = undefined
})
it("should return correct URL", function() {
everypaas.detect({}, path.join(__dirname, 'dotcloud-env-good.json'))
// Set a valid Redis service named "db"
var url = "redis://root:password@host:1234"
everypaas.dotCloudEnvironment.DOTCLOUD_DB_REDIS_URL = url
expect(everypaas.getRedisUrl()).to.eql(url)
// now unset and set another service named "data"
delete everypaas.dotCloudEnvironment['DOTCLOUD_DB_REDIS_URL']
everypaas.dotCloudEnvironment.DOTCLOUD_DATA_REDIS_URL = url
expect(everypaas.getRedisUrl()).to.eql(url)
})
it("should fail when service not configured", function() {
// no Redis service
everypaas.detect({}, path.join(__dirname, 'dotcloud-env-good.json'))
expect(everypaas.getRedisUrl()).to.not.exist;
})
after(function() {
delete everypaas.dotCloudEnvironment
})
})
describe("#on Heroku", function() {
it("should return correct URL for Redis To Go add-on", function() {
var url = "redis://root:password@host:1234"
everypaas.detect({PORT:123, "REDISTOGO_URL":url})
expect(everypaas.paas).to.eql(everypaas.HEROKU)
expect(everypaas.getRedisUrl()).to.eql(url)
})
it("should return correct URL for OpenRedis add-on", function() {
var url = "redis://root:password@host:1234"
everypaas.detect({PORT:123, "OPENREDIS_URL":url})
expect(everypaas.paas).to.eql(everypaas.HEROKU)
expect(everypaas.getRedisUrl()).to.eql(url)
})
it("should fail when service not configured", function() {
// no Redis service
everypaas.detect({PORT:123, "NONE":"foo"})
expect(everypaas.getRedisUrl()).to.not.exist;
})
})
describe("#on Strider", function() {
it("should return correct URL for Redis", function() {
var url = "redis://root:password@host:1234"
var parsedUrl = require('url').parse(url)
everypaas.detect({PAAS_NAME:"strider", "REDIS_HOST": parsedUrl.hostname,
"REDIS_PORT": parsedUrl.port, "REDIS_PASSWORD": parsedUrl.auth.split(':')[1]})
expect(everypaas.paas).to.eql(everypaas.STRIDER)
expect(everypaas.getRedisUrl()).to.eql(url)
})
it("should fail when service not configured", function() {
// no Redis service
everypaas.detect({PAAS_NAME:"strider", "NONE":"foo"})
expect(everypaas.getRedisUrl()).to.not.exist;
})
})
})

@@ -303,0 +369,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc