diff options
| author | Adam Soltys <[email protected]> | 2013-10-27 22:11:49 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2013-10-27 22:11:49 -0700 |
| commit | 9edc8a787ddb552afd24ef00c3c3b7eeb0945ab9 (patch) | |
| tree | ff79ab6a7f8de164a528089a007e620f26c02035 /install.coffee | |
| parent | c343c79e33cd68cfbf2b6b1e81dcf1144b261dc1 (diff) | |
| download | coinos-server-9edc8a787ddb552afd24ef00c3c3b7eeb0945ab9.tar.gz coinos-server-9edc8a787ddb552afd24ef00c3c3b7eeb0945ab9.zip | |
Move seed data into install script
Diffstat (limited to 'install.coffee')
| -rw-r--r-- | install.coffee | 28 |
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() |
