Skip to content
Browse files

separated configuration into a separate file

  • Loading branch information...
1 parent 3803de3 commit f46a3fccc0e9f1a10736737aa6c149cb0132d9aa Geoff Flarity committed Feb 7, 2012
Showing with 15 additions and 10 deletions.
  1. +7 −10 bin/nervous
  2. +6 −0 conf/nervous.json
  3. +2 −0 install.sh
View
17 bin/nervous
@@ -1,21 +1,18 @@
#!/usr/bin/env node
-//config
-var plugins_home = '../plugins';
-
-var system_type = 'graphite';
-var config = {
- graphite_host : 'stats01-smc03',
- graphite_port : '2003',
- graphite_namespace : 'nervous.www02-smc03'
-};
//deps
var fs = require('fs');
-var axon_factory = require('../lib/axon_factory')( system_type, config );
var path = require('path');
//code
+var full_path_of_config = require.resolve( '../conf/nervous.json' );
+var config = JSON.parse(fs.readFileSync( full_path_of_config ) );
+
+var system_type = config.system_type;
+var axon_factory = require('../lib/axon_factory')( system_type, config );
+
+var plugins_home = '../plugins';
var full_path_of_test_js = require.resolve( plugins_home + '/test.js' );
var full_plugins_path = path.dirname( full_path_of_test_js ) + '/node_modules';
View
6 conf/nervous.json
@@ -0,0 +1,6 @@
+{
+ "system_type" : "graphite",
+ "graphite_host" : "stats01-smc03",
+ "graphite_port" : "2003",
+ "graphite_namespace" : "nervous.www02-smc03"
+}
View
2 install.sh
@@ -16,7 +16,9 @@ PREFIX=${PREFIX:-$DEFAULT_PREFIX}
/bin/mkdir -p $PREFIX/nervous/bin
/bin/mkdir -p $PREFIX/nervous/log
/bin/mkdir -p $PREFIX/nervous/lib
+/bin/mkdir -p $PREFIX/nervous/conf
/bin/mkdir -p $PREFIX/nervous/plugins/node_modules
$INSTALL -m 0755 -t $PREFIX/nervous/bin bin/nervous
$INSTALL -m 0644 -t $PREFIX/nervous/plugins plugins/test.js
+$INSTALL -m 0644 -t $PREFIX/nervous/conf conf/nervous.json
$INSTALL -m 0644 -t $PREFIX/nervous/lib lib/*js

0 comments on commit f46a3fc

Please sign in to comment.
Something went wrong with that request. Please try again.