aboutsummaryrefslogtreecommitdiffstats
path: root/src/install.coffee
blob: 7ba2449d489404f8ddaff937ef9ddf40b23f1e93 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
db = require("./redis")
bcrypt = require('bcryptjs')

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'")
          process.exit()
       )
    )
)