aboutsummaryrefslogtreecommitdiffstats
path: root/install.coffee
diff options
context:
space:
mode:
Diffstat (limited to 'install.coffee')
-rw-r--r--install.coffee28
1 files changed, 28 insertions, 0 deletions
diff --git a/install.coffee b/install.coffee
new file mode 100644
index 00000000..a47ac12a
--- /dev/null
+++ b/install.coffee
@@ -0,0 +1,28 @@
+db = require("./redis")
+bcrypt = require('bcrypt')
+
+db.get("user:admin", (err, res) ->
+ if !res
+ bcrypt.hash('admin', 12, (err, hash) ->
+ db.sadd("users","user:admin")
+ db.hmset("user:admin",
+ username: 'admin'
+ password: hash,
+ , ->
+ console.log("Created admin user with password 'admin'")
+ )
+ )
+)
+
+db.sismember("mts","mt:rest", (err,res) ->
+ if !res
+ db.hmset("mt:rest",{code: "rest", label: "Restaurant/Bar"}, ->
+ db.sadd("mts","mt:rest")
+ )
+ db.hmset("mt:coff",{code: "rest", label: "Coffee Shop"}, ->
+ db.sadd("mts","mt:coff")
+ )
+ console.log("Added merchant types")
+)
+
+process.exit()