From 9862f0a390b1624487dd12e32659dd7e6632f7d0 Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Thu, 24 Jun 2021 21:46:13 +1000 Subject: [PATCH] Add support for using https:// references to HL7 website --- .../hl7/fhir/utilities/npm/PackageHacker.java | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/npm/PackageHacker.java b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/npm/PackageHacker.java index 26e7d9637..76c1e5cfc 100644 --- a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/npm/PackageHacker.java +++ b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/npm/PackageHacker.java @@ -24,8 +24,10 @@ import com.google.gson.JsonObject; */ public class PackageHacker { + private static boolean useSecureReferences = false; + public static void main(String[] args) throws FileNotFoundException, IOException { - new PackageHacker().edit("M:\\web\\hl7.org\\fhir\\us\\carin-rtpbc\\package.tgz"); + new PackageHacker().edit("M:\\web\\hl7.org\\fhir\\2021Mar\\hl7.fhir.r4b.expansions.tgz"); } private void edit(String name) throws FileNotFoundException, IOException { @@ -57,8 +59,8 @@ public class PackageHacker { private void change(JsonObject npm, Map content) throws FileNotFoundException, IOException { fixVersions(npm); - npm.remove("url"); - npm.addProperty("url", "http://hl7.org/fhir/us/carin-rtpbc/STU1"); + npm.remove("notForPublication"); +// npm.addProperty("url", "http://hl7.org/fhir/us/carin-rtpbc/STU1"); // npm.remove("name"); // npm.addProperty("name", "hl7.fhir.uv.smart-app-launch"); // npm.remove("canonical"); @@ -137,7 +139,19 @@ public class PackageHacker { case "file://C:\\GitHub\\hl7.fhir.uv.security-label-ds4p#0.1.0\\output": return "http://hl7.org/fhir/uv/security-label-ds4p/2020May"; case "file://C:\\GitHub\\hl7.fhir.uv.shorthand#0.12.0\\output": return "http://hl7.org/fhir/uv/shorthand/2020May"; } - return webref; + if (isUseSecureReferences()) { + return webref.replace("http://hl7.org/fhir", "https://hl7.org/fhir").replace("http://build.fhir.org", "https://build.fhir.org"); + } else { + return webref; + } + } + + public static boolean isUseSecureReferences() { + return useSecureReferences; + } + + public static void setUseSecureReferences(boolean useSecureReferences) { + PackageHacker.useSecureReferences = useSecureReferences; } } \ No newline at end of file