Permalink
Browse files

config

  • Loading branch information...
1 parent 0208322 commit 197b68558c4ec022d8022c5b29705144d99cfe3c @vovazolotoy vovazolotoy committed Aug 2, 2011
Showing with 14 additions and 10 deletions.
  1. +3 −2 johana.js
  2. +8 −5 system/prototypes/johana/config.js
  3. +3 −3 system/prototypes/johana/core.js
View
@@ -22,7 +22,6 @@ DOCROOT = require('fs').realpathSync('.') + '/';
*/
require(SYSPATH + 'prototypes/johana/core');
-
if (require('path').existsSync(APPPATH + 'prototypes/johana.js'))
{
// Application extends the core
@@ -39,5 +38,7 @@ require(SYSPATH + 'prototypes/johana/autoload');
// Bootstrap the application
require(APPPATH + 'bootstrap');
-//console.log(Johana.config('bootstrap'));
+Johana.conf.attach(new ConfigFile());
+
+console.log(Johana.config('vova'));
@@ -79,6 +79,11 @@ JohanaConfig = function()
*/
this.load = function(group)
{
+ if (_readers.length === 0)
+ {
+ throw new Error('No configuration readers attached');
+ }
+
for (var reader in _readers)
{
var config = _readers[reader].load(group);
@@ -90,12 +95,10 @@ JohanaConfig = function()
}
}
- if (_readers.length === 0)
- {
- throw new Error('No configuration readers attached');
- }
+ // Reset the iterator
+ var config = _readers.slice(0, 1)[0];
- // Load the reader as an empty array
+ // Load the reader as an empty object
return config.load(group, {});
};
@@ -102,7 +102,7 @@ JohanaCore.log;
/**
* @var Config config object
*/
-JohanaCore._config;
+JohanaCore.conf;
/**
* @var Boolean Has [Johana.init] been called?
@@ -272,7 +272,7 @@ JohanaCore.init = function(settings)
// Johana.log = Log.instance();
//
// Load the config
- Johana._config = Config.instance();
+ Johana.conf = Config.instance();
};
/**
@@ -600,7 +600,7 @@ JohanaCore.config = function(group)
if (_configCache[group] === undefined)
{
// Load the config group into the cache
- _configCache[group] = Johana._config.load(group);
+ _configCache[group] = Johana.conf.load(group);
}
if (path !== false)

0 comments on commit 197b685

Please sign in to comment.