Get configurations from a metadata service with fallbacks


Gets configurations from metadata services running on ec2 or openstack, and has a fallback for when those services aren't available (Like on your dev system)

Console logs when it uses backup, and lets you know why its using backup


var config = require('metaconfig');
var opts =  { backup: { db : 'test'}};
config.readConfig(opts, function(conf){
function startApp(){
  var c = config.getConfig();
  // Config is cached after readConfig! 


metaconfig is very small, one async function for reading from metadata service and one for getting a cached version

Reads in the configuration from the meta data service, by default it uses , but you can use a different url by passing it the option userdata_url.

ReadConfig expects a json string from the metadata service with the config stored at key "app_config"; This can be changed by passing the key option.

ReadConfig will cache the configuration until readConfig is called again.

Sync function returns the cached configuration

  "app_name" : "nova-metadata-test",
  "version" : "0.0.1",
  "app_config": {
      "memory" :  "",
        "db" : "cloud"