Cloud Foundry auto-configuration module


cf-autoconfig is a Node.js module that reconfigures server and service functions so they can automatically run on Cloud Foundry without manual configuration.

npm install cf-autoconfig

If cloned from github install dependencies:

npm install -d

Require this on the first line of your start script:


That's it!

cf-autoconfig reconfigures functions of modules listed below if they are accessible in node require path or on any level of node_modules folder tree. This means that any modules that depend on these reconfigured modules will also be reconfigured.

Core module: "net" Functions:

  • Server.listen()

Plus all functions that inherit from this one. This includes core http.Server.listen and https.Server.listen. And node modules functions that wrap this one, like express's app.listen function.

Module: mongodb Functions:

  • connect()
  • new Db()
  • new Server()
  • db.authenticate()

Module: mongoose

  • (and other mongoose functions that wrap this one)

Module: mysql Functions:

  • createClient()
  • Client._connect() (other functions and modules use this for auto connect)

Module: pg Functions:

  • defaults (default connection variables)
  • connect()
  • new Client()

Module: redis Functions:

  • createClient()
  • auth()

Module: amqp Functions:

  • createConnection()
  • new Connection()