Skip to content

Commit

Permalink
* Introducing "ethercalc --key secret" command line option for Issue a…
Browse files Browse the repository at this point in the history
  • Loading branch information
audreyt authored and jeffhung committed Apr 21, 2012
1 parent 7ebcefe commit 10ba28a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
5 changes: 4 additions & 1 deletion app.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ argv = try require('optimist').argv
json = try JSON.parse(require('fs').readFileSync('/home/dotcloud/environment.json', 'utf8'))
port = Number(argv?.port || json?.PORT_NODEJS || process.env.PORT || process.env.VCAP_APP_PORT) || 8000
host = argv?.host || process.env.VCAP_APP_HOST || '0.0.0.0'
key = argv?.key || null

console.log "Please connect to: http://#{if host is '0.0.0.0' then require('os').hostname() else host}:#{port}/"
require('zappa') port, host, -> @include 'main'
require('zappa') port, host, ->
@KEY = key
@include 'main'
7 changes: 4 additions & 3 deletions app.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Generated by CoffeeScript 1.3.1

/*
CC0 1.0 Universal
Expand All @@ -11,9 +10,8 @@ This work is published from Taiwan.
<http://creativecommons.org/publicdomain/zero/1.0>
*/


(function() {
var argv, host, json, port;
var argv, host, json, key, port;

argv = (function() {
try {
Expand All @@ -31,9 +29,12 @@ This work is published from Taiwan.

host = (argv != null ? argv.host : void 0) || process.env.VCAP_APP_HOST || '0.0.0.0';

key = (typeof args !== "undefined" && args !== null ? args.key : void 0) || null;

console.log("Please connect to: http://" + (host === '0.0.0.0' ? require('os').hostname() : host) + ":" + port + "/");

require('zappa')(port, host, function() {
if (key) this.app._key = key;
return this.include('main');
});

Expand Down
1 change: 1 addition & 0 deletions main.coffee
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@include = ->
# console.log @KEY
@enable 'serve jquery'
@use 'bodyParser', @app.router, @express.static __dirname
@include 'dotcloud'
Expand Down

0 comments on commit 10ba28a

Please sign in to comment.