forked from cozy-labs/konnectors
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.coffee
executable file
·37 lines (28 loc) · 975 Bytes
/
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
americano = require 'americano'
RealtimeAdapter = require 'cozy-realtime-adapter'
localization = require './server/lib/localization_manager'
initKonnectors = require './server/init/konnectors'
poller = require './server/lib/poller'
commitPatch = require './server/init/patch_commits'
log = require('printit')
prefix: 'konnectors'
process.env.TZ = 'UTC'
params =
name: 'konnectors'
port: process.env.PORT or 9358
host: process.env.HOST or '127.0.0.1'
root: __dirname
application = module.exports = (callback) ->
americano.start params, (err, app, server) ->
# Configure realtime listening.
realtime = RealtimeAdapter server, [
'konnector.update'
'folder.*'
]
localization.initialize ->
initKonnectors ->
poller.start()
log.info 'Import poller started.'
callback(app, server) if callback?
if not module.parent
application()