View on GitHub

spas

Super Proxy Asset Server

Download this project as a .zip file Download this project as a tar.gz file

Configure

spas uses a simple json configuration file (config.json). You'll want to edit this file to match your environment. There are two branches to the config file: development and live. If you pass the dev parameter to spas:

$ node spas --dev

or if you are global

$ spas --dev

the development values will be used. Otherwise, the live values will be used.

Here's a sample config file:

{
  "development": {
    "url": "http://localhost:3000",
    "port": 3000,
    "redis": {
      "port": 6379,
      "address": "localhost"
    }		
  },
  "live": {
    "url": "http://spas.mycompany.com",
    "port": 80,
    "redis": {
      "port": 6379,
      "address": "nodejitsudb123456789.redis.irstack.com",
      "auth": "nodejitsudb123456789.redis.irstack.com:f123abc456d978901e23f4g567hijkl8"
    }
  }
}

url: The root URL for spas
port: This is the port on which spas will listen for requests
redis: The redis configuration object
redis.port: The port that redis is listening on
redis.address: The address of your redis server
reds.auth: (Optional) If your redis server is password protected, use the password here

Configure authentication services

spas can use OAuth or OAuth2 to authenticate as a user against api providers. Important: This is not a mechanism for your users to authenticate themselves, this is so spas can authenticate as the owner of the resources you wish to use. There is only one user per bundle part (see Build your bundle for an explanation of bundle parts).

Here's a sample development node with authentication providers:

"development": {
  "url": "http://localhost:3000",
  "port": 3000,
  "redis": {
    "port": 6379,
    "address": "localhost"
  },
  "authentication": {
    "google": {
      "baseSite": "https://accounts.google.com",
      "authorizePath": "/o/oauth2/auth",
      "accessTokenPath": "/o/oauth2/token",
      "client_id": "12345678901-ipsumloremgobbledygook.apps.googleusercontent.com",
      "client_secret": "shhhhiamyoursecret"
    },
    "smugmug": {
      "requestTemporaryCredentials": "https://api.smugmug.com/services/oauth/getRequestToken.mg",
      "authorize": "https://api.smugmug.com/services/oauth/authorize.mg",
      "requestAccessToken": "https://api.smugmug.com/services/oauth/getAccessToken.mg",
      "version": "1.0",
      "encryption": "PLAINTEXT",
      "oauth_consumer_key": "ipsumloremgobbledygook",
      "client_secret": "shhhhiamyoursecret"
    }
  }
}

The google node above is using oAuth2.

baseSite: The base URL for authentication
authorizePath: The authorize path
accessTokenPath: The access token path
client_id: Your application's client id
client_secret: Your application's secret

The smugmug node above is using oAuth.

requestTemporaryCredentials: URL for temporary credentials
authorize: The authorize path
requestAccessToken: The access token path
version: oAuth version
encryption: Encryption type for your requests
oauth_consumer_key: Your application's consumer key
client_secret: Your application's secret

Next: Build Your Bundle