Add support for using https:// references to HL7 website

This commit is contained in:
Grahame Grieve 2021-06-24 21:46:13 +10:00
parent c827a06698
commit 9862f0a390
1 changed files with 18 additions and 4 deletions

View File

@ -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<String, byte[]> 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;
}
}