forked from pimatic/pimatic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstartup.coffee
31 lines (26 loc) · 829 Bytes
/
startup.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
# #Framwork start up
assert = require 'cassert'
fs = require 'fs'
path = require 'path'
# Setup the environment
env =
logger: require './lib/logger'
devices: require './lib/devices'
rules: require './lib/rules'
plugins: require './lib/plugins'
actions: require './lib/actions'
predicates: require './lib/predicates'
require: (args...) -> module.require args...
# set the config file to
configFile = (
# PIMATIC_CONFIG envirement variable if it is set
if process.env.PIMATIC_CONFIG? then process.env.PIMATIC_CONFIG
# or get the config the parent folder of node_modules
else path.resolve __dirname, '../../config.json'
)
# Setup the framework
Framework = (require './lib/framework') env
framework = new Framework configFile
promise = framework.init()
promise.done()
module.exports.framework = framework