aboutsummaryrefslogtreecommitdiffstats
path: root/src/install.coffee
diff options
context:
space:
mode:
Diffstat (limited to 'src/install.coffee')
-rw-r--r--src/install.coffee16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/install.coffee b/src/install.coffee
new file mode 100644
index 00000000..38e32b6f
--- /dev/null
+++ b/src/install.coffee
@@ -0,0 +1,16 @@
+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'")
+ process.exit()
+ )
+ )
+)