Skip to content

Commit

Permalink
MOSIP-29095 (mosip#83)
Browse files Browse the repository at this point in the history
Co-authored-by: JanardhanBS-SyncByte <janardhan@syncbyte.in>
Signed-off-by: Loganathan Sekar <m1047627@mindtree.com>
  • Loading branch information
2 people authored and Loganathan Sekar committed Oct 13, 2023
1 parent 4f125a0 commit fcbeef5
Show file tree
Hide file tree
Showing 8 changed files with 74 additions and 12 deletions.
18 changes: 17 additions & 1 deletion biosdk-services/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
FROM openjdk:11

# can be passed during Docker build as build time environment for github branch to pickup configuration from.
ARG spring_config_label

# can be passed during Docker build as build time environment for spring profiles active
ARG active_profile

# can be passed during Docker build as build time environment for config server URL
ARG spring_config_url

# environment variable to pass github branch to pickup configuration from, at docker runtime
ENV spring_config_label_env=${spring_config_label}
# environment variable to pass active profile such as DEV, QA etc at docker runtime
ENV active_profile_env=${active_profile}
# environment variable to pass spring configuration url, at docker runtime
ENV spring_config_url_env=${spring_config_url}

ARG biosdk_zip_url

ENV biosdk_zip_file_path=${biosdk_zip_url}
Expand Down Expand Up @@ -69,4 +85,4 @@ EXPOSE 9099
ENTRYPOINT [ "./configure_biosdk.sh" ]

CMD echo $biosdk_bioapi_impl ; \
java -Dloader.path="${loader_path_env}" -Dbiosdk_bioapi_impl="${biosdk_bioapi_impl}" -Dserver.servlet.context-path="${service_context_env}" -Dlogging.level.root=${logging_level_root_env} -jar biosdk-services.jar
java -Dloader.path="${loader_path_env}" -Dbiosdk_bioapi_impl="${biosdk_bioapi_impl}" -Dserver.servlet.context-path="${service_context_env}" -Dlogging.level.root=${logging_level_root_env} -jar -Dspring.cloud.config.label="${spring_config_label_env}" -Dspring.profiles.active="${active_profile_env}" -Dspring.cloud.config.uri="${spring_config_url_env}" biosdk-services.jar
4 changes: 2 additions & 2 deletions biosdk-services/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@

<!-- Mosip kernel -->
<kernel.biometrics.api.version>1.2.0.1-SNAPSHOT</kernel.biometrics.api.version>
<kernel.logger.logback.version>1.2.0.1-SNAPSHOT</kernel.logger.logback.version>
<kernel.core.version>1.2.0.1-SNAPSHOT</kernel.core.version>
<kernel.logger.logback.version>1.2.0.1-B1</kernel.logger.logback.version>
<kernel.core.version>1.2.0.1-B1</kernel.core.version>
<!-- Spring -->
<spring.boot.version>2.0.2.RELEASE</spring.boot.version>
</properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
@SpringBootApplication()
public class SdkApplication {
public static void main(String[] args) {
SpringApplication.run(SdkApplication.class, args);
}
public static void main(String[] args) {
SpringApplication.run(SdkApplication.class, args);
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.mosip.biosdk.services.config;

import io.mosip.kernel.biometrics.spi.IBioApi;
import io.mosip.kernel.biometrics.spi.IBioApiV2;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -35,12 +35,12 @@ public void validateBioSdkLib() throws ClassNotFoundException {

@Bean
@Lazy
public IBioApi iBioApi() throws ClassNotFoundException, InstantiationException, IllegalAccessException {
public IBioApiV2 iBioApi() throws ClassNotFoundException, InstantiationException, IllegalAccessException {
String sdkClass = this.env.getProperty("biosdk_bioapi_impl");
logger.info("Biosdk class: " + sdkClass);
if (StringUtils.isNotBlank(sdkClass)) {
logger.debug("instance of Bio SDK is created");
return (IBioApi)Class.forName(sdkClass).newInstance();
return (IBioApiV2)Class.forName(sdkClass).newInstance();
} else {
logger.debug("no Bio SDK is provided");
throw new RuntimeException("No Bio SDK is provided");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import io.mosip.biosdk.services.factory.BioSdkServiceFactory;
import io.mosip.biosdk.services.spi.BioSdkServiceProvider;
import io.mosip.biosdk.services.utils.Utils;
import io.mosip.kernel.biometrics.spi.IBioApi;
import io.mosip.kernel.biometrics.spi.IBioApiV2;
import io.mosip.kernel.core.logger.spi.Logger;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
Expand Down Expand Up @@ -46,7 +46,7 @@ public class MainController {
private Utils serviceUtil;

@Autowired
private IBioApi iBioApi;
private IBioApiV2 iBioApi;

@Autowired
private BioSdkServiceFactory bioSdkServiceFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@
import io.mosip.kernel.biometrics.model.SDKInfo;
import io.mosip.kernel.biometrics.spi.IBioApiV2;
import io.mosip.kernel.core.logger.spi.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import static io.mosip.biosdk.services.constants.AppConstants.LOGGER_IDTYPE;
import static io.mosip.biosdk.services.constants.AppConstants.LOGGER_SESSIONID;

@Component
public class BioSdkServiceProviderImpl_V_1_0 implements BioSdkServiceProvider {
Expand Down
10 changes: 10 additions & 0 deletions biosdk-services/src/main/resources/application-local.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#iam mock-sdk config
sdk_check_iso_timestamp_format=true
biosdk_class=io.mosip.mock.sdk.impl.SampleSDKV2
mosip.role.biosdk.getservicestatus=REGISTRATION_PROCESSOR
biosdk_bioapi_impl=io.mosip.mock.sdk.impl.SampleSDKV2

#iam image-compressor config
mosip.bio.image.compressor.resize.factor.fx=0.25
mosip.bio.image.compressor.resize.factor.fy=0.25
mosip.bio.image.compressor.compression.ratio=50
31 changes: 31 additions & 0 deletions biosdk-services/src/main/resources/bootstrap.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
spring.cloud.config.uri=http://localhost:51000/config
spring.cloud.config.label=master
spring.profiles.active=default
spring.application.name=biosdk-service
spring.cloud.config.name=biosdk-service
server.port=9099
security.basic.enabled=false
server.servlet.context-path=/biosdk-service

spring.cloud.config.enabled=true
server.servlet.context-path=/biosdk-service
health.config.enabled=false
management.security.enable=false
management.endpoint.health.show-details=always
management.endpoints.web.exposure.include=info,health,refresh,mappings
management.endpoint.metrics.enabled=true
management.endpoint.prometheus.enabled=true
management.metrics.export.prometheus.enabled=true

#logging.level.org.springframework=DEBUG

#iam mock-sdk config
sdk_check_iso_timestamp_format=true
biosdk_class=io.mosip.mock.sdk.impl.SampleSDKV2
mosip.role.biosdk.getservicestatus=REGISTRATION_PROCESSOR
biosdk_bioapi_impl=io.mosip.mock.sdk.impl.SampleSDKV2

#iam image-compressor config
mosip.bio.image.compressor.resize.factor.fx=0.25
mosip.bio.image.compressor.resize.factor.fy=0.25
mosip.bio.image.compressor.compression.ratio=50

0 comments on commit fcbeef5

Please sign in to comment.