diff --git a/index.html b/index.html index 577373e..cb231a7 100644 --- a/index.html +++ b/index.html @@ -107,7 +107,7 @@ +
@@ -331,7 +343,7 @@

FAQ

m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); - ga('create', 'UA-42843113-1', 'bitstart.net'); + ga('create', 'UA-42972788-1', 'wherearemyfiles.net'); ga('send', 'pageview'); diff --git a/package.json b/package.json index 2eb6645..659af7c 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,10 @@ "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, + "repository": { + "type": "git", + "url": "https://github.com/startup-class/bitstarter-ssjs-db.git" + }, "dependencies": { "sequelize": "~2.0.0-alpha2", "pg": "~2.3.1", diff --git a/pgsetup.sh b/pgsetup.sh index 216bad8..0924c66 100755 --- a/pgsetup.sh +++ b/pgsetup.sh @@ -18,6 +18,7 @@ sudo apt-get install -y postgresql postgresql-contrib # Symlink into home. # Note the use of backticks, PWD, and the -t flag. +# allows for auto-login with "psql" ln -sf `ls $PWD/.pgpass` -t $HOME chmod 600 $HOME"/.pgpass" diff --git a/setup-ssjs.sh b/setup-ssjs.sh index 821315d..6e33d3a 100755 --- a/setup-ssjs.sh +++ b/setup-ssjs.sh @@ -6,10 +6,10 @@ echo -e "\n\nNOW ENTER YOUR HEROKU PASSWORD" # Set up heroku. # - devcenter.heroku.com/articles/config-vars # - devcenter.heroku.com/articles/heroku-postgresql -heroku login +#heroku login heroku create -ssh-keygen -t rsa -heroku keys:add +#ssh-keygen -t rsa +#heroku keys:add heroku addons:add heroku-postgresql:dev heroku pg:promote `heroku config | grep HEROKU_POSTGRESQL | cut -f1 -d':'` heroku plugins:install git://github.com/ddollar/heroku-config.git @@ -19,7 +19,7 @@ heroku plugins:install git://github.com/ddollar/heroku-config.git # - Edit .env to include your own COINBASE_API_KEY and HEROKU_POSTGRES_URL. # - Modify the .env.dummy file, and DO NOT check .env into the git repository. # - See .env.dummy for details. -cp .env.dummy .env +#cp .env.dummy .env # For local: setup postgres (one-time) and then run the local server ./pgsetup.sh diff --git a/web.js b/web.js index 5e7fcab..c72cd48 100644 --- a/web.js +++ b/web.js @@ -33,6 +33,50 @@ app.get('/orders', function(request, response) { }); }); +// Show some configuration variables -- this works, but isn't at all secure, +// so we shouldn't actually use it in production +/* +app.get('/dbconfig', function(request, response) { + response.send(global.db.sequelize.config); +}); +*/ + +// This is also not very secure (mind you, /orders isn't either), and is also +// pretty ugly. But it felt good to write and get working! +// ah go on, let it run -- when in Development +app.get('/addrs', function(request, response) { + if (process.env.DEVELOPMENT) { + https.get("https://coinbase.com/api/v1/addresses?api_key=" + process.env.COINBASE_API_KEY, function(res) { + var body = ''; + res.on('data', function(chunk) {body += chunk;}); + res.on('end', function() { + // response.send("Hi, here are your addresses:" + body); + var output = ''; + var addresses_json = JSON.parse(body); + if (addresses_json.error) { + response.send(addresses_json.error); + return; + } + // don't bother with fancy DB entries or asynchronicity + addresses_json.addresses.forEach(function(address) { + output += "address " + address.address.address + + " at " + address.address.created_at + "
"; + }); + response.send("Your addresses:
" + output); + }); + + res.on('error', function(e) { + console.log(e); + response.send("error getting addresses"); + }); + }); + } + else { + response.send("nope, nothing to see here."); + } +}); +// end little test + // Hit this URL while on example.com/orders to refresh app.get('/refresh_orders', function(request, response) { https.get("https://coinbase.com/api/v1/orders?api_key=" + process.env.COINBASE_API_KEY, function(res) {