From 796f410248eded615ac14bb3fabeb8c78f59214a Mon Sep 17 00:00:00 2001 From: jomo Date: Sun, 23 Nov 2014 23:13:25 +0100 Subject: [PATCH] allow custom config --- .gitignore | 1 + .travis.yml | 5 +++-- Procfile | 2 +- README.md | 1 + modules/config.example.js | 13 +++++++++++++ modules/config.js | 4 ++-- 6 files changed, 21 insertions(+), 5 deletions(-) create mode 100644 modules/config.example.js diff --git a/.gitignore b/.gitignore index aed9c83..4e398b0 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ node_modules/ .DS_Store *.rdb coverage/ +modules/config.js diff --git a/.travis.yml b/.travis.yml index 5a0bfe9..58e6785 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,11 +1,12 @@ language: node_js node_js: - "0.10" +before_script: + - cp "modules/config.example.js" "modules/config.js" notifications: irc: channels: - "irc.esper.net#spongy" skip_join: true services: - - redis-server -skip_join: true \ No newline at end of file + - redis-server \ No newline at end of file diff --git a/Procfile b/Procfile index e8f79ea..7778d31 100644 --- a/Procfile +++ b/Procfile @@ -1 +1 @@ -web: npm start \ No newline at end of file +web: cp "modules/config.example.js" "modules/config.js" && npm start \ No newline at end of file diff --git a/README.md b/README.md index c7fc96b..1001ab0 100644 --- a/README.md +++ b/README.md @@ -20,5 +20,6 @@ You can [join us](https://webchat.esper.net/?channels=spongy) in #spongy on irc. * Clone the repository * `npm install` * `redis-server` +* `cp "modules/config.example.js" "modules/config.js"` * `npm start` * Access [http://localhost:3000](http://localhost:3000) \ No newline at end of file diff --git a/modules/config.example.js b/modules/config.example.js new file mode 100644 index 0000000..52698ad --- /dev/null +++ b/modules/config.example.js @@ -0,0 +1,13 @@ +var config = { + min_size: 1, // < 1 will (obviously) cause crash + max_size: 512, // too big values might lead to slow response time or DoS + default_size: 160, // size to be used when no size given + local_cache_time: 3600, // seconds until we will check if the image changed. should be > 60 to prevent mojang 429 response + browser_cache_time: 3600, // seconds until browser will request image again + http_timeout: 1000, // ms until connection to mojang is dropped + faces_dir: 'skins/faces/', // directory where faces are kept. should have trailing '/' + helms_dir: 'skins/helms/', // directory where helms are kept. should have trailing '/' + debug_enabled: false // enables logging.debug +}; + +module.exports = config; \ No newline at end of file diff --git a/modules/config.js b/modules/config.js index 0934c0d..4b77193 100644 --- a/modules/config.js +++ b/modules/config.js @@ -7,7 +7,7 @@ var config = { http_timeout: 3000, // ms until connection to mojang is dropped faces_dir: 'skins/faces/', // directory where faces are kept. should have trailing '/' helms_dir: 'skins/helms/', // directory where helms are kept. should have trailing '/' - debug_enabled: true // enables logging.debug + debug_enabled: true // enables logging.debug }; -module.exports = config; +module.exports = config; \ No newline at end of file