Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Allow providing default configuration shared between loaded extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
bergie committed Aug 14, 2012
1 parent 510fcf9 commit 9bdb103
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/Extension.coffee
Expand Up @@ -94,6 +94,7 @@ exports.loadExtensions = (config) ->
will be set as the `urlPrefix` key of the extension configuration.
###
config ?= {}
config.extensionDefaults ?= {}
config.extensions ?= []

return loaded unless _.isEmpty loaded
Expand All @@ -106,5 +107,5 @@ exports.loadExtensions = (config) ->
extension.location = path.resolve config.projectRoot, extension.location

ext = require "#{extension.location}/main"
loaded[extension.name] = new ext.extension extension.configuration
loaded[extension.name] = new ext.extension _.defaults extension.configuration, config.extensionDefaults
loaded
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -3,7 +3,7 @@
"description": "Plugin-driven Node.js applications",
"keywords": ["server", "express", "extension", "framework"],
"author": "Henri Bergius",
"version": "0.1.4",
"version": "0.1.5",
"licenses": [{
"type": "MIT",
"url": "https://github.com/bergie/nodext/raw/master/LICENSE"
Expand Down

0 comments on commit 9bdb103

Please sign in to comment.