forked from cozy/cozy-home-v2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.coffee
executable file
·39 lines (30 loc) · 1.11 KB
/
server.coffee
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
process.on 'uncaughtException', (err) ->
console.error err
console.error err.stack
application = module.exports = (callback) ->
americano = require 'americano'
request = require 'request-json'
localization = require './server/lib/localization_manager'
initProxy = require './server/initializers/proxy'
setupRealtime = require './server/initializers/realtime'
versionChecking = require './server/initializers/updates'
autoStop = require './server/lib/autostop'
options =
name: 'Cozy Home'
port: process.env.PORT or 9103
host: process.env.HOST or "127.0.0.1"
root: __dirname
americano.start options, (app, server) ->
app.server = server
if process.env.NODE_ENV isnt "test"
initProxy()
# initialize market when app starts
market = require './server/lib/market'
market.download ->
localization.initialize ->
setupRealtime app, ->
versionChecking()
autoStop.init()
callback app, server if callback?
if not module.parent
application()