Browse files


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...
1 parent 139b5cb commit 026fa52fe3e5baae8b562ce47b9add3a120c20e2 @andrewtch andrewtch committed Jan 4, 2013
Showing with 2 additions and 3 deletions.
  1. +2 −3
@@ -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
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
-var settings = config.readConfig('config/app.yaml', 'test');
+var settings = config.readConfig('./config/app.yaml', 'test');
console.log(settings.redis.db); // prints 12

0 comments on commit 026fa52

Please sign in to comment.