diff --git a/pom.xml b/pom.xml
index b4e8c0d9..ffe74404 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
com.iemr.common-API
common-api
- 3.8.1
+ 3.8.2
war
Common-API
diff --git a/src/main/environment/common_docker.properties b/src/main/environment/common_docker.properties
index 064090b3..aca7345a 100644
--- a/src/main/environment/common_docker.properties
+++ b/src/main/environment/common_docker.properties
@@ -218,4 +218,4 @@ otp.ratelimit.enabled=${OTP_RATELIMIT_ENABLED}
otp.ratelimit.minute-limit=${OTP_RATELIMIT_MINUTE_LIMIT}
otp.ratelimit.hour-limit=${OTP_RATELIMIT_HOUR_LIMIT}
otp.ratelimit.day-limit=${OTP_RATELIMIT_DAY_LIMIT}
-generateBeneficiaryIDs-api-url={GEN_BENEFICIARY_IDS_API_URL}
+generateBeneficiaryIDs-api-url=${GEN_BENEFICIARY_IDS_API_URL}
diff --git a/src/main/java/com/iemr/common/config/firebase/FirebaseMessagingConfig.java b/src/main/java/com/iemr/common/config/firebase/FirebaseMessagingConfig.java
index ebb697ec..08d9a518 100644
--- a/src/main/java/com/iemr/common/config/firebase/FirebaseMessagingConfig.java
+++ b/src/main/java/com/iemr/common/config/firebase/FirebaseMessagingConfig.java
@@ -21,16 +21,19 @@
public class FirebaseMessagingConfig {
private Logger logger = LoggerFactory.getLogger(this.getClass().getSimpleName());
- @Value("${firebase.enabled:false}")
+ @Value("${firebase.enabled}")
private boolean firebaseEnabled;
- @Value("${firebase.credential-file:}")
+ @Value("${firebase.credential-file}")
private String firebaseCredentialFile;
@Bean
@ConditionalOnProperty(name = "firebase.enabled", havingValue = "true")
public FirebaseMessaging firebaseMessaging() throws IOException {
+ logger.info("===== Initializing Firebase =====");
+ logger.info("firebaseEnabled={}", firebaseEnabled);
+ logger.info("firebaseCredentialFile={}", firebaseCredentialFile);
if (!firebaseEnabled) {
logger.error("⚠️ Firebase disabled by config");
return null;
@@ -42,9 +45,11 @@ public FirebaseMessaging firebaseMessaging() throws IOException {
return null; // don't throw, app will still start
}
- GoogleCredentials credentials = GoogleCredentials.fromStream(
- new ClassPathResource(firebaseCredentialFile).getInputStream()
- );
+ GoogleCredentials credentials =
+ GoogleCredentials.fromStream(
+ new FileInputStream(firebaseCredentialFile)
+ );
+
FirebaseOptions options = FirebaseOptions.builder()
.setCredentials(credentials)
.build();
diff --git a/src/main/java/com/iemr/common/controller/connect/ConnectController.java b/src/main/java/com/iemr/common/controller/connect/ConnectController.java
new file mode 100644
index 00000000..7ecf45ba
--- /dev/null
+++ b/src/main/java/com/iemr/common/controller/connect/ConnectController.java
@@ -0,0 +1,57 @@
+/*
+* AMRIT – Accessible Medical Records via Integrated Technology
+* Integrated EHR (Electronic Health Records) Solution
+*
+* Copyright (C) "Piramal Swasthya Management and Research Institute"
+*
+* This file is part of AMRIT.
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program. If not, see https://www.gnu.org/licenses/.
+*/
+package com.iemr.common.controller.connect;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.http.MediaType;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import com.iemr.common.utils.NetworkUtil;
+
+import io.swagger.v3.oas.annotations.Operation;
+
+/**
+ * Exposes the server's LAN address so a mobile device on the same wifi
+ * network can connect to this API.
+ */
+@RestController
+@RequestMapping(value = "/public/connect")
+public class ConnectController {
+
+ @Value("${server.port:8080}")
+ private int serverPort;
+
+ @Operation(summary = "Get the server's LAN IP address and port")
+ @GetMapping(value = "/info", produces = MediaType.APPLICATION_JSON_VALUE)
+ public ResponseEntity