Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# --- Stage 1: Build the application using Maven ---
FROM maven:3.9.6-eclipse-temurin-17 AS build

WORKDIR /app

COPY . .

# Build the application while caching Maven dependencies to speed up future builds
RUN --mount=type=cache,target=/root/.m2 \
mvn clean package -DENV_VAR=docker -DskipTests -Dgit.skip=true

# --- Stage 2: Run the application with a minimal JRE image ---
FROM eclipse-temurin:17-jre

WORKDIR /app

# Copy the built WAR file from the build stage
COPY --from=build /app/target/*.war app.war

EXPOSE 8080

ENTRYPOINT ["java", "-jar", "app.war"]
33 changes: 22 additions & 11 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,22 +56,21 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>co.elastic.logging</groupId>
<artifactId>logback-ecs-encoder</artifactId>
<version>1.3.2</version>
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>${slf4j.version}</version>
</dependency>
<!-- Swagger -->
<dependency>
<groupId>org.springdoc</groupId>
Expand Down Expand Up @@ -477,6 +476,18 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>3.2.2</version>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down
3 changes: 1 addition & 2 deletions src/main/environment/common_ci.properties
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ oncoWL=7
tcSpeclistWL=7

### Redis IP
spring.redis.host=localhost
spring.redis.host=@env.REDIS_HOST@
jwt.secret=@env.JWT_SECRET_KEY@


Expand All @@ -76,4 +76,3 @@ logging.file.name=@env.TM_API_LOGGING_FILE_NAME@

springdoc.api-docs.enabled=@env.SWAGGER_DOC_ENABLED@
springdoc.swagger-ui.enabled=@env.SWAGGER_DOC_ENABLED@

76 changes: 76 additions & 0 deletions src/main/environment/common_docker.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# local env
# DB Connections
spring.datasource.url=${DATABASE_URL}
spring.datasource.username=${DATABASE_USERNAME}
spring.datasource.password=${DATABASE_PASSWORD}
spring.datasource.driver-class-name=com.mysql.jdbc.Driver

## Carestream URLs
carestreamOrderCreateURL=${COMMON_API}/carestream/createOrder

## Identity - Common URLs
# Registration
registrationUrl=${COMMON_API}/beneficiary/create

registrarQuickSearchByIdUrl=${COMMON_API}/beneficiary/searchUserByID

registrarQuickSearchByPhoneNoUrl=${COMMON_API}/beneficiary/searchUserByPhone

getBenImageFromIdentity=${IDENTITY_API}/id/benImageByBenRegID

## beneficiary edit
beneficiaryEditUrl=${COMMON_API}/beneficiary/update

## Advance Search
registrarAdvanceSearchUrl=${COMMON_API}/beneficiary/searchBeneficiary

## Data Sync API
dataSyncUploadUrl=${MMU_API}/dataSync/van-to-server

## Data download API
dataSyncDownloadUrl=${MMU_API}/dataSync/server-to-van

## TC specialist slot booking
tcSpecialistSlotBook=${SCHEDULER_API}/schedule/bookSlot

## TC specialist slot cancelling
tcSpecialistSlotCancel=${SCHEDULER_API}/schedule/cancelBookedSlot

## TM sms to beneficiary(schedule, cancel, reschedule)
sendSMSUrl=${COMMON_API}/sms/sendSMS

### get openkm doc download url
openkmDocUrl=${COMMON_API}/kmfilemanager/getKMFileDownloadURL

## Fetosense Url
fetosense-api-url-ANCTestDetails=https://asia-south1-amrit-fetosense.cloudfunctions.net/insertMother

## apiKey for calling fetosense api
fetosenseAPIKey=${FETOSENSE_API_KEY}

## TM SMS template details(SMS type)
schedule=TC Schedule SMS
cancel=TC Cancel SMS
reSchedule=TC Reschedule SMS

snomedCTPageSize=10
prescription=TMPrescription SMS

nurseWL=7
nurseTCWL=7
docWL=7
pharmaWL=7
labWL=7
radioWL=7
oncoWL=7
tcSpeclistWL=7

### Redis IP
spring.redis.host=${REDIS_HOST}
jwt.secret=${JWT_SECRET_KEY}

#ELK logging file name
logging.file.name=${TM_API_LOGGING_FILE_NAME}

springdoc.api-docs.enabled=${SWAGGER_DOC_ENABLED}
springdoc.swagger-ui.enabled=${SWAGGER_DOC_ENABLED}
12 changes: 9 additions & 3 deletions src/main/java/com/iemr/tm/utils/JwtAuthenticationUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -112,16 +112,22 @@ private Users fetchUserFromDB(String userId) {
Users user = userLoginRepo.getUserByUserID(Long.parseLong(userId));

if (user != null) {
// Cache the user in Redis for future requests (cache for 30 minutes)
redisTemplate.opsForValue().set(redisKey, user, 30, TimeUnit.MINUTES);
Users userHash = new Users();
userHash.setUserID(user.getUserID());
userHash.setUserName(user.getUserName());

// Cache the minimal user in Redis for future requests (cache for 30 minutes)
redisTemplate.opsForValue().set(redisKey, userHash, 30, TimeUnit.MINUTES);

// Log that the user has been stored in Redis
logger.info("User stored in Redis with key: " + redisKey);

return user;
} else {
logger.warn("User not found for userId: " + userId);
}

return user;
return null;
}

}
2 changes: 1 addition & 1 deletion src/main/resources/logback-spring.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<configuration>
<property name="LOG_FILE"
value="${LOG_FILE:-${LOG_PATH:-${LOG_TEMP:-${java.io.tmpdir:-/tmp}}}/my-api}" />
value="${LOG_FILE:-${LOG_PATH:-${LOG_TEMP:-${java.io.tmpdir:-/tmp}}}/tm-api}" />
<include resource="org/springframework/boot/logging/logback/defaults.xml" />
<include resource="org/springframework/boot/logging/logback/console-appender.xml" />
<appender name="ECS_JSON_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
Expand Down
Loading