Skip to content

Commit

Permalink
Allow register() to be used for modules, too.
Browse files Browse the repository at this point in the history
  • Loading branch information
alinex committed Jul 7, 2015
1 parent 657f5b8 commit ac05c37
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 14 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,9 @@ config.register myapp, __dirname,
Like you see, you may also add the attributes from the normal configuration
like `uri` and so on.

You may also register a module. Therefore give `null` as application name and
it will only add the first two paths based on the given directory.


Setup schema
-------------------------------------------------
Expand Down
29 changes: 15 additions & 14 deletions src/index.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -75,20 +75,21 @@ module.exports =
parser: setup.parser
path: setup.path
filter: setup.filter
# add global
list.push
uri: "/etc/#{app}/#{uri}"
parser: setup.parser
path: setup.path
filter: setup.filter
# add user
dir = process.env.HOME ? process.env.USERPROFILE
list.push
uri: "#{dir}/.#{app}/config/#{uri}"
parser: setup.parser
path: setup.path
filter: setup.filter
@origin.push list
if app
# add global
list.push
uri: "/etc/#{app}/#{uri}"
parser: setup.parser
path: setup.path
filter: setup.filter
# add user
dir = process.env.HOME ? process.env.USERPROFILE
list.push
uri: "#{dir}/.#{app}/config/#{uri}"
parser: setup.parser
path: setup.path
filter: setup.filter
@origin.push list

setSchema: (path, schema, cb = -> ) ->
path = string.trim(path, '/').split '/'
Expand Down

0 comments on commit ac05c37

Please sign in to comment.