diff options
| author | Adam Soltys <[email protected]> | 2014-07-31 21:06:23 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2014-07-31 21:06:23 -0700 |
| commit | 7c5dfc8d51efe4df4e67f86f33c489a320fcb8f9 (patch) | |
| tree | f387c3d4e3ce9ed0c464659a787b99d8c6e90fb9 /src/install.js | |
| parent | de1cdd2e3f9d9f36ce3d8e97335341cc3237e829 (diff) | |
| download | coinos-server-7c5dfc8d51efe4df4e67f86f33c489a320fcb8f9.tar.gz coinos-server-7c5dfc8d51efe4df4e67f86f33c489a320fcb8f9.zip | |
Move coffee files to src/ folder
Diffstat (limited to 'src/install.js')
| -rw-r--r-- | src/install.js | 23 |
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); |
