aboutsummaryrefslogtreecommitdiffstats
path: root/src/install.coffee
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2014-07-31 21:06:23 -0700
committerAdam Soltys <[email protected]>2014-07-31 21:06:23 -0700
commit7c5dfc8d51efe4df4e67f86f33c489a320fcb8f9 (patch)
treef387c3d4e3ce9ed0c464659a787b99d8c6e90fb9 /src/install.coffee
parentde1cdd2e3f9d9f36ce3d8e97335341cc3237e829 (diff)
downloadcoinos-server-7c5dfc8d51efe4df4e67f86f33c489a320fcb8f9.tar.gz
coinos-server-7c5dfc8d51efe4df4e67f86f33c489a320fcb8f9.zip
Move coffee files to src/ folder
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()
+ )
+ )
+)