From 9edc8a787ddb552afd24ef00c3c3b7eeb0945ab9 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Sun, 27 Oct 2013 22:11:49 -0700 Subject: Move seed data into install script --- install.coffee | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 install.coffee (limited to 'install.coffee') 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() -- cgit v1.2.3