Skip to content

Commit

Permalink
Update Readme.md
Browse files Browse the repository at this point in the history
js-yaml registers handler, but only for local files; 'config/app.yaml' is treated as module name, and, thus, can not be loaded.

Prefixing module with './' fixes this.
  • Loading branch information
andrewtch committed Jan 4, 2013
1 parent 139b5cb commit 026fa52
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

# yaml-config

Manage your configuration based on NODE_ENV, all configuration defined with yaml. Shared configuration can be put under `default` key, different settings under each enviroment name.
Expand Down Expand Up @@ -33,14 +32,14 @@ In your source code
```javascript
var config = require('yaml-config');
var settings = config.readConfig('config/app.yaml'); // path from your app root without slash
var settings = config.readConfig('./config/app.yaml'); // path from your app root without slash
console.log(settings.redis.db); // if NODE_ENV is development, prints 1
```

The `readConfig()` function takes a second parameter as enviroment name, for example

```javascript
var settings = config.readConfig('config/app.yaml', 'test');
var settings = config.readConfig('./config/app.yaml', 'test');
console.log(settings.redis.db); // prints 12
```

Expand Down

0 comments on commit 026fa52

Please sign in to comment.