diff --git a/dice-where-downloader-lib/src/main/java/technology/dice/dicewhere/downloader/source/ipinfosite/IpInfoSiteSource.java b/dice-where-downloader-lib/src/main/java/technology/dice/dicewhere/downloader/source/ipinfosite/IpInfoSiteSource.java index bce3e60..17cd7c7 100644 --- a/dice-where-downloader-lib/src/main/java/technology/dice/dicewhere/downloader/source/ipinfosite/IpInfoSiteSource.java +++ b/dice-where-downloader-lib/src/main/java/technology/dice/dicewhere/downloader/source/ipinfosite/IpInfoSiteSource.java @@ -33,7 +33,7 @@ public FileInfo fileInfo() { dataConnection.setRequestMethod("HEAD"); if (dataConnection.getResponseCode() > 299 || dataConnection.getResponseCode() < 200) { - throw new DownloaderException("Could not find remote file"); + throw new DownloaderException("Could not find remote file " + dataConnection.getResponseCode()); } long fileSize = dataConnection.getContentLengthLong(); diff --git a/dice-where-downloader-lib/src/main/java/technology/dice/dicewhere/downloader/source/maxmindsite/MaxmindSiteSource.java b/dice-where-downloader-lib/src/main/java/technology/dice/dicewhere/downloader/source/maxmindsite/MaxmindSiteSource.java index 7d01f0a..9f1f7f4 100644 --- a/dice-where-downloader-lib/src/main/java/technology/dice/dicewhere/downloader/source/maxmindsite/MaxmindSiteSource.java +++ b/dice-where-downloader-lib/src/main/java/technology/dice/dicewhere/downloader/source/maxmindsite/MaxmindSiteSource.java @@ -33,7 +33,7 @@ public synchronized FileInfo fileInfo() { dataConnection.setRequestMethod("HEAD"); if (dataConnection.getResponseCode() > 299 || dataConnection.getResponseCode() < 200) { - throw new DownloaderException("Could not find remote file"); + throw new DownloaderException("Could not find remote file " + dataConnection.getResponseCode()); } long fileSize = dataConnection.getContentLengthLong(); diff --git a/dice-where-downloader/src/main/java/technology/dice/dicewhere/downloader/picocli/commands/DownloadIpInfoSiteCommand.java b/dice-where-downloader/src/main/java/technology/dice/dicewhere/downloader/picocli/commands/DownloadIpInfoSiteCommand.java index 678a409..f7f2e49 100644 --- a/dice-where-downloader/src/main/java/technology/dice/dicewhere/downloader/picocli/commands/DownloadIpInfoSiteCommand.java +++ b/dice-where-downloader/src/main/java/technology/dice/dicewhere/downloader/picocli/commands/DownloadIpInfoSiteCommand.java @@ -10,10 +10,12 @@ name = "ipinfo-site", description = "Downloads the selected IpInfo dataset from IpInfo's website") public class DownloadIpInfoSiteCommand extends IpInfoBaseCommand { - @Option( - names = {"-t", "--token"}, - required = true, - description = "The ipinfo download key") + + @Option( + names = {"-t", "--token"}, + required = false, + defaultValue = "${env:IPINFO_API_KEY}", + description = "The ipinfo download key") String token; @Parameters( @@ -26,6 +28,6 @@ public class DownloadIpInfoSiteCommand extends IpInfoBaseCommand { public DownloadExecutionResult execute() { return new DownloadIpInfoSite( noCheckMd5, overwrite, verbose, dataset, format, token, destination) - .execute(); + .execute(); } } diff --git a/dice-where-downloader/src/main/java/technology/dice/dicewhere/downloader/picocli/commands/DownloadMaxmindSiteCommand.java b/dice-where-downloader/src/main/java/technology/dice/dicewhere/downloader/picocli/commands/DownloadMaxmindSiteCommand.java index 9c13dfa..e1619f9 100644 --- a/dice-where-downloader/src/main/java/technology/dice/dicewhere/downloader/picocli/commands/DownloadMaxmindSiteCommand.java +++ b/dice-where-downloader/src/main/java/technology/dice/dicewhere/downloader/picocli/commands/DownloadMaxmindSiteCommand.java @@ -11,10 +11,11 @@ description = "Downloads the selected Maxmind edition of a database from Maxmind's website") public class DownloadMaxmindSiteCommand extends MaxmindBaseCommand { - @Option( - names = {"-k", "--key"}, - required = true, - description = "The maxmind download key") + @Option( + names = {"-k", "--key"}, + required = false, + defaultValue = "${env:MAXMIND_API_KEY}", + description = "The maxmind download key") String key; @Parameters(