From 66719b99323b7704939f365432f124eb32f0ba9a Mon Sep 17 00:00:00 2001 From: Martin Polden Date: Tue, 24 Dec 2019 17:31:27 +0100 Subject: [PATCH] Download GeoIP databases on startup --- .gitignore | 2 +- Makefile | 6 ++++++ heroku.yml | 4 +--- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index e208308..ac30f00 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,4 @@ /custom.html /vendor/ .vscode/ -/bin/ \ No newline at end of file +/bin/ diff --git a/Makefile b/Makefile index c35a922..c80b973 100644 --- a/Makefile +++ b/Makefile @@ -47,3 +47,9 @@ docker-test: docker-push: docker-test docker-login docker push $(DOCKER_IMAGE) + +heroku-run: geoip-download +ifndef PORT + $(error PORT must be set) +endif + echoip -f data/country.mmdb -c data/city.mmdb -a data/asn.mmdb -p -r -H CF-Connecting-IP -H X-Forwarded-For -l :$(PORT) diff --git a/heroku.yml b/heroku.yml index 1e3ea0d..a597b77 100644 --- a/heroku.yml +++ b/heroku.yml @@ -1,7 +1,5 @@ build: languages: - go - pre: - - make geoip-download run: - web: echoip -f data/country.mmdb -c data/city.mmdb -a data/asn.mmdb -p -r -H CF-Connecting-IP -H X-Forwarded-For -l :$PORT + web: make heroku-run