Skip to content

Loading…

Update Readme.md #6

Merged
merged 1 commit into from

2 participants

@andrewtch

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.

@andrewtch andrewtch Update Readme.md
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.
026fa52
@rjyo rjyo merged commit bc22da9 into rjyo:master
@rjyo
Owner

Thank you @andrewtch !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 4, 2013
  1. @andrewtch

    Update Readme.md

    andrewtch committed
    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.
This page is out of date. Refresh to see the latest.
Showing with 2 additions and 3 deletions.
  1. +2 −3 Readme.md
View
5 Readme.md
@@ -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.
@@ -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
```
Something went wrong with that request. Please try again.