allow to prohibit network access from within code

This commit is contained in:
Grahame Grieve 2023-04-21 12:25:54 +08:00
parent 81b3295f3c
commit 580079f26d
1 changed files with 16 additions and 2 deletions

View File

@ -16,6 +16,7 @@ public class FhirSettings {
public static final String FHIR_SETTINGS_PATH = "fhir.settings.path";
private static String explicitFilePath = null;
private static Boolean prohibitNetworkAccess;
public static void setExplicitFilePath(String explicitFilePath) {
if (instance != null) {
@ -114,14 +115,27 @@ public class FhirSettings {
}
public static boolean hasProhibitNetworkAccess() {
if (prohibitNetworkAccess != null) {
return true;
}
getInstance();
return instance.fhirSettings.getProhibitNetworkAccess() != null; }
return instance.fhirSettings.getProhibitNetworkAccess() != null;
}
public static boolean isProhibitNetworkAccess() {
if (prohibitNetworkAccess != null) {
return prohibitNetworkAccess;
}
getInstance();
return instance.fhirSettings.getProhibitNetworkAccess() == null
? false
: instance.fhirSettings.getProhibitNetworkAccess(); }
: instance.fhirSettings.getProhibitNetworkAccess();
}
public static void setProhibitNetworkAccess(boolean value) {
prohibitNetworkAccess = value;
}
private static FhirSettings instance = null;
private static FhirSettings getInstance() {