aboutsummaryrefslogtreecommitdiffstats
path: root/src/install.coffee
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2014-08-08 11:33:43 -0700
committerAdam Soltys <[email protected]>2014-08-08 11:33:43 -0700
commit2cc86381a6f79cd729048b34a72b70562a7b0ace (patch)
treec42dda997719ce544a4dea2bf15937d293ebfd59 /src/install.coffee
parent3082e274b70a93fdac8a9a63934252ed914fe406 (diff)
parent6d5c3a56067b96bb5d97cca4a80bacbf78395b2c (diff)
downloadcoinos-server-2cc86381a6f79cd729048b34a72b70562a7b0ace.tar.gz
coinos-server-2cc86381a6f79cd729048b34a72b70562a7b0ace.zip
Merge branch 'code_reorg'
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()
+ )
+ )
+)