Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

use setting.js for server config, cfg.js for def

  • Loading branch information...
commit 284366661b37c98350aaba06b9bbd19ad197b2b7 1 parent 688341a
@kaven276 authored
Showing with 39 additions and 19 deletions.
  1. +31 −19 lib/cfg.js
  2. +7 −0 lib/util.js
  3. +1 −0  upload/readme.md
View
50 lib/cfg.js
@@ -1,20 +1,32 @@
-var fs = require('fs');
-module.exports = {
- host_base_parts:2,
- oracle_port:1521,
- http_port:80,
- https_port:443,
- server_name:'PSP.WEB',
- accept_count:10, // accept connection queue limits
- keepalive_timeout:1200, // default to 20 minutes
- upload_dir:'/Users/cuccpkfs/dev/upload/',
- upload_depth:4, // can specify 1,2,3,4, to divide the 16 byte random string to parts to avoid too big directory, default/more is 2
- static_root:'/Users/cuccpkfs/dev/static', // specify where the static file root directory is at
- favicon_path:'../public/favicon.ico',
- favicon_max_age:24 * 60 * 60,
- ssl_key:fs.readFileSync('server.key'),
- ssl_cert:fs.readFileSync('server.cert'),
- plsql_mount_point:'/', // if mount to nodejs connect's path, it's not empty
- file_mount_point:'/',
- dummy:undefined // just keep it for diff friendly
+var defCfg = {
+ oracle_port : 1521, // accept oracle reversed connection to establish communication path between nodeJS and oracle
+ http_port : 80, // port that accept browser(client) http request
+ https_port : 443, // port that accept browser(client) https request
+ ssl_key : undefined, // server side ssl key text for https service
+ ssl_cert : undefined, // server side ssl certification text for https service
+ accept_count : 10, // accept connection queue limits, when all oracle socket is in use, requests will go to queue.
+ keepalive_timeout : 1200, // browser to server keepalive timeout, default to 20 minutes
+
+ favicon_path : '../public/favicon.ico', // where is the site's favicon icon at
+ favicon_max_age : 24 * 60 * 60, // how long is browser hold the favicon in cache
+ plsql_mount_point : '/', // where to mount all plsql page for combined server
+ file_mount_point : '/', // where to mount all static file for combined server
+ static_root : '../static', // specify where the static file root directory is at
+ upload_dir : '../upload', // specify upload root directory
+ upload_depth : 4, // can specify 1,2,3,4, to divide the 16 byte random string to parts to avoid too big directory, default/more is 2
+
+ host_base_parts : 2, // specify the number of suffix parts in host dns name, the remaining head in host is host prefix
+ server_name : 'PSP.WEB', // specify the value of http response header "server_name“
+
+ dummy : undefined // just keep it for diff friendly
}
+var setting;
+try {
+ setting = require('../setting.js');
+}
+catch (e) {
+ console.error(e);
+ setting = {}
+}
+
+module.exports = require('./util.js').override(defCfg, setting);
View
7 lib/util.js
@@ -18,3 +18,10 @@ exports.ensureDir = function(path){
fs.mkdirSync(tryPath);
}
}
+
+exports.override = function(def, setting){
+ for (var n in def)
+ if (setting[n])
+ def[n] = setting[n];
+ return def;
+}
View
1  upload/readme.md
@@ -0,0 +1 @@
+ By default setting, all upload file will be placed in this directory.
Please sign in to comment.
Something went wrong with that request. Please try again.