aboutsummaryrefslogtreecommitdiffstats
path: root/src/install.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/install.js')
-rw-r--r--src/install.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/install.js b/src/install.js
new file mode 100644
index 00000000..088d593e
--- /dev/null
+++ b/src/install.js
@@ -0,0 +1,23 @@
+(function() {
+ var bcrypt, db;
+
+ db = require("./redis");
+
+ bcrypt = require('bcrypt');
+
+ db.get("user:admin", function(err, res) {
+ if (!res) {
+ return bcrypt.hash('admin', 12, function(err, hash) {
+ db.sadd("users", "user:admin");
+ return db.hmset("user:admin", {
+ username: 'admin',
+ password: hash
+ }, function() {
+ console.log("Created admin user with password 'admin'");
+ return process.exit();
+ });
+ });
+ }
+ });
+
+}).call(this);