From 5316a31da533aa106a793cc7714556a7765c4d7b Mon Sep 17 00:00:00 2001 From: Adrian Short Date: Wed, 17 Oct 2018 13:05:09 +0100 Subject: [PATCH] Move Morph API url to an environment variable [skip ci] This allows the codebase to be deployed and reference a different instance of inlink-scraper on Morph if necessary. --- bin/download | 7 +++---- netlify.toml | 5 +++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/bin/download b/bin/download index 9694e62..2af5274 100755 --- a/bin/download +++ b/bin/download @@ -5,12 +5,11 @@ require 'rest-client' require 'json' require 'pp' -morph_api_url = 'https://api.morph.io/adrianshort/inlink-scraper/data.json' - -result = RestClient.get(morph_api_url, params: { +result = RestClient.get(ENV['MORPH_API_URL'], params: { key: ENV['MORPH_API_KEY'], query: "select * from applications" }) apps = JSON.parse(result) -ScraperWiki.save_sqlite(['authority_name', 'council_reference'], apps, 'applications') +ScraperWiki.save_sqlite( \ + ['authority_name', 'council_reference'], apps, 'applications') diff --git a/netlify.toml b/netlify.toml index 8d83e70..3be8c57 100644 --- a/netlify.toml +++ b/netlify.toml @@ -4,7 +4,8 @@ command = "bundle exec bin/download && bundle exec bin/petrify" [template] - incoming-hooks = ["Morph"] + incoming-hooks = ["Morph scrape completed"] [template.environment] - MORPH_API_KEY = "change me" + MORPH_API_KEY = "Your secret Morph API key" + MORPH_API_URL = "https://api.morph.io/adrianshort/inlink-scraper/data.json"