aboutsummaryrefslogtreecommitdiffstats
path: root/install.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2014-07-20 11:24:09 -0700
committerAdam Soltys <[email protected]>2014-07-20 11:40:36 -0700
commit51daca704f27e59462c6d8b1731867007c8fd273 (patch)
treee573e97c4704710ff1fd8dbd5ff033504847890a /install.js
parent9b8d66d8a7c9417132358ac2b0f0dbfa4fcd9fcd (diff)
downloadcoinos-server-51daca704f27e59462c6d8b1731867007c8fd273.tar.gz
coinos-server-51daca704f27e59462c6d8b1731867007c8fd273.zip
Precompile all coffeescript
Diffstat (limited to 'install.js')
-rw-r--r--install.js40
1 files changed, 40 insertions, 0 deletions
diff --git a/install.js b/install.js
new file mode 100644
index 00000000..0e6256df
--- /dev/null
+++ b/install.js
@@ -0,0 +1,40 @@
+(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() {
+ return console.log("Created admin user with password 'admin'");
+ });
+ });
+ }
+ });
+
+ db.sismember("mts", "mt:rest", function(err, res) {
+ if (!res) {
+ db.hmset("mt:rest", {
+ code: "rest",
+ label: "Restaurant/Bar"
+ }, function() {
+ return db.sadd("mts", "mt:rest");
+ });
+ db.hmset("mt:coff", {
+ code: "rest",
+ label: "Coffee Shop"
+ }, function() {
+ return db.sadd("mts", "mt:coff");
+ });
+ return console.log("Added merchant types");
+ }
+ });
+
+}).call(this);