lib/core/index.js
function getConf( path, environment, callback, context ) {

	// relative paths need to be auto-prefixed with the environment
	if ( path.match( /^[^\.]/ ) ) {
		path = "." + environment + "." + path;
	}

	if ( !context ) {
		context = {
			pathsSeen: {}
		};
	}

	// avoid circular references
	if ( context.pathsSeen[path] ) {
		callback( undefined );
		return;
	}
	context.pathsSeen[path] = true;

	// calculate catch all path
	var catchAllPath = ".*." + path.replace( /^\.[^\.]*\./, '' );
	if ( catchAllPath === path ) {
		catchAllPath = false;
	}

	// try exact path
	moduleConfig.storage.getConf( path, function ( err, conf ) {

		// if there was an error, don't try for wildcard
		if ( err ) {
			callback( undefined );
		}

		// not found, try wildcard
		else if ( conf === null && catchAllPath ) {

			moduleConfig.storage.getConf( catchAllPath, function ( err, conf ) {

				// error searching for wild card
				if ( err ) {
					callback( undefined );
				}

				// wild card found
				else {
					applyAbstractions( conf, environment, context, callback );
				}

			} );

		}

		// exact path found
		else {
			applyAbstractions( conf, environment, context, callback );
		}

	} );

}
function getConf( path, environment, callback, context ) {

	// relative paths need to be auto-prefixed with the environment
	if ( path.match( /^[^\.]/ ) ) {
		path = "." + environment + "." + path;
	}

	if ( !context ) {
		context = {
			pathsSeen: {}
		};
	}

	// avoid circular references
	if ( context.pathsSeen[path] ) {
		callback( undefined );
		return;
	}
	context.pathsSeen[path] = true;

	// calculate catch all path
	var catchAllPath = ".*." + path.replace( /^\.[^\.]*\./, '' );
	if ( catchAllPath === path ) {
		catchAllPath = false;
	}

	// try exact path
	moduleConfig.storage.getConf( path, function ( err, conf ) {

		// if there was an error, don't try for wildcard
		if ( err ) {
			callback( undefined );
		}

		// not found, try wildcard
		else if ( conf === null && catchAllPath ) {

			moduleConfig.storage.getConf( catchAllPath, function ( err, conf ) {

				// error searching for wild card
				if ( err ) {
					callback( undefined );
				}

				// wild card found
				else {
					applyAbstractions( conf, environment, context, callback );
				}

			} );

		}

		// exact path found
		else {
			applyAbstractions( conf, environment, context, callback );
		}

	} );

}
function getConf ( path , environment , callback , context ) { // relative paths need to be auto-prefixed with the environment if ( path . match ( / ^[^\.] / ) ) { path = "." + environment + "." + path ; } if ( ! context ) { context = { pathsSeen : { } } ; } // avoid circular references if ( context . pathsSeen [ path ] ) { callback ( undefined ) ; return ; } context . pathsSeen [ path ] = true ; // calculate catch all path var catchAllPath = ".*." + path . replace ( / ^\.[^\.]*\. / , '' ) ; if ( catchAllPath === path ) { catchAllPath = false ; } // try exact path moduleConfig . storage . getConf ( path , function ( err , conf ) { // if there was an error, don't try for wildcard if ( err ) { callback ( undefined ) ; } // not found, try wildcard else if ( conf === null && catchAllPath ) { moduleConfig . storage . getConf ( catchAllPath , function ( err , conf ) { // error searching for wild card if ( err ) { callback ( undefined ) ; } // wild card found else { applyAbstractions ( conf , environment , context , callback ) ; } } ) ; } // exact path found else { applyAbstractions ( conf , environment , context , callback ) ; } } ) ; }
getConf is responsible for the core logic in the API. It handles applying all extensions and wildcard lookups.

External Params:
@param path the dot notation path to pull from the storage engine
@param environment the name of the environment to pull the configuration for
@param callback

Recursive Params:
@param context
getConf is responsible for the core logic in the API . It handles applying all extensions and wildcard lookups .