1.0.0 • Published 9 years ago

palmettoflow-service-container v1.0.0

Weekly downloads
3
License
ISC
Repository
github
Last release
9 years ago

Palmetto Flow Service Container

An opionatied palmetto flow service container that can load services with a common pattern:

example

var fetchConfig = require('zero-config')
var config = fetchConfig(__dirname, { dcValue: 'us-east-1'})
var sc = require('palmettoflow-service-container')
sc(config, [
  'service1',
  'service2',
  'service3'
])

The pfsc will initialize the list of services with the following higher order function:

module.exports = function (config) {
  return function (ee) {
    // ... do stuff
  }
}

Using the service container you need the configuration for your services, the adapter and to npm install the services.

If you use zero-config then put the name of your adapter and all of your service's configuration information by the name of the service.

{
  "adapter": "@twilson63/palmetto-couchdb",
  "palmetto": {
    "endpoint": "",
    "app": ""
  },
  "service1": {
    "config1": "foo",
    "config2": "bar"
  },
  "service2": {
    "config1": "foo"
  }
}

Then npm install the adapter and the service.

npm install zero-config palmettoflow-service-container service1 service2 @twilson63/palmetto-couchdb

Finally, create a file index.js and setup the configuration and services:

var fetchConfig = require('zero-config')
var config = fetchConfig(__dirname, { dcValue: 'us-east-1'})
var sc = require('palmettoflow-service-container')
sc(config, [
  'service1',
  'service2',
  'service3'
])