aboutsummaryrefslogtreecommitdiffstats
path: root/install.coffee
blob: fa95f6f8197be867b544fe9d04fd26099ec8a9e5 (plain) (blame)
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
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")
)