Skip to content

Commit

Permalink
Merge pull request #169 from anup-nehe/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
aranaravi authored Aug 17, 2023
2 parents 7a29505 + e1da752 commit 9c6c3b0
Showing 1 changed file with 16 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,15 @@ public class ConfigManager {

private static final org.slf4j.Logger logger= org.slf4j.LoggerFactory.getLogger(ConfigManager.class);

// private static String MOSIP_PMS_CLIENT_SECRET = "mosip_pms_client_secret";
// private static String MOSIP_PMS_CLIENT_ID = "mosip_pms_client_id";
// private static String MOSIP_PMS_APP_ID = "mosip_pms_app_id";
//
// private static String MOSIP_RESIDENT_CLIENT_SECRET = "mosip_resident_client_secret";
// private static String MOSIP_RESIDENT_CLIENT_ID = "mosip_resident_client_id";
// private static String MOSIP_RESIDENT_APP_ID = "mosip_resident_app_id";
//
// private static String MOSIP_MOBILE_CLIENT_ID = "mpartner_default_mobile_client_id";
// private static String MOSIP_MOBILE_CLIENT_SECRET = "mpartner_default_mobile_secret";
//
private static String IAM_ADMINPORTAL_PATH = "PmpPortalPath";
private static String IAM_EXTERNAL_URL = "keycloak-external-url";

private static String IAM_APIENVUSER = "apiEnvUser";
private static String IAM_APIINTERNALENDPOINT = "apiInternalEndPoint";
private static String MOSIP_IDREPO_CLIENT_SECRET = "mosip_idrepo_client_secret";
private static String MOSIP_IDREPO_CLIENT_ID = "mosip_idrepo_client_id";
private static String MOSIP_IDREPO_APP_ID = "mosip_idrepo_app_id";
//

private static String MOSIP_ADMIN_CLIENT_SECRET = "mosip_admin_client_secret";
private static String MOSIP_ADMIN_CLIENT_ID = "mosip_admin_client_id";
private static String MOSIP_ADMIN_APP_ID = "mosip_admin_app_id";
Expand Down Expand Up @@ -118,6 +108,8 @@ public class ConfigManager {
private static String idrepo_client_id;
private static String idrepo_app_id;
//

private static String IAM_EXTERNAL_URL = "keycloak-external-url";
private static String admin_client_secret;
private static String admin_client_id;
private static String admin_app_id;
Expand Down Expand Up @@ -175,8 +167,8 @@ public class ConfigManager {
private static String master_db_user;
private static String master_db_pass;
private static String master_db_schema;
//
private static String iam_external_url;

private static String iamExternalURL;
private static String iam_realm_id;
private static String iam_users_to_create;
private static String iam_users_password;
Expand Down Expand Up @@ -213,6 +205,8 @@ public static void init() {

propsKernel = getproperty(TestRunner.getResourcePath() + "/" + "resources/config/Kernel.properties");

iamExternalURL = getValueForKey(IAM_EXTERNAL_URL);

// pms_client_secret = getValueForKey(MOSIP_PMS_CLIENT_SECRET);
// pms_client_id = getValueForKey(MOSIP_PMS_CLIENT_ID);
// pms_app_id = getValueForKey(MOSIP_PMS_APP_ID);
Expand Down Expand Up @@ -280,29 +274,11 @@ public static void init() {
master_db_pass = getValueForKey(MASTER_DB_PASS);
master_db_schema = getValueForKey(MASTER_DB_SCHEMA);

// iam_external_url = System.getenv(IAM_EXTERNAL_URL) == null
// ? propsKernel.getProperty(IAM_EXTERNAL_URL)
// : System.getenv(IAM_EXTERNAL_URL);
// logger.info("env from doc" +System.getenv(IAM_EXTERNAL_URL));
// logger.info("env from kernal"+System.getProperty(IAM_EXTERNAL_URL));
// logger.info("iam_external_url config manager init::" + iam_external_url);
//

// iam_external_url = getValueForKey(IAM_EXTERNAL_URL);
// logger.info("keycloakendpoint from config manager init::" + iam_external_url);

iam_adminportal_path =System.getenv(IAM_ADMINPORTAL_PATH) == null
? propsKernel.getProperty(IAM_ADMINPORTAL_PATH)
: System.getenv(IAM_ADMINPORTAL_PATH);

iam_external_url =System.getenv(IAM_EXTERNAL_URL) == null
? propsKernel.getProperty(IAM_EXTERNAL_URL)
: System.getenv(IAM_EXTERNAL_URL);
logger.info("env from doc" +System.getenv(IAM_EXTERNAL_URL));
logger.info("env from kernal"+System.getProperty(IAM_EXTERNAL_URL));



logger.info("adminportal_path from config manager::" + iam_adminportal_path);
iam_apienvuser = System.getenv(IAM_APIENVUSER) == null
? propsKernel.getProperty(IAM_APIENVUSER)
Expand Down Expand Up @@ -651,27 +627,12 @@ public static String getMasterDbPass() {
public static String getMasterDbSchema() {
return master_db_schema;
}
//
// // from docker env getting only host url
// public static String getiam_external_url() {
// logger.info("keycloak url extarnal:::" + iam_external_url + "/auth");
// return iam_external_url + "/auth";
// }

public static String getIAMUrl() {
logger.info("keycloak url from ENV::: " + System.getenv(IAM_EXTERNAL_URL) + "/auth");
logger.info("keycloak url from Property::: " + System.getProperty(IAM_EXTERNAL_URL) + "/auth");
logger.info("keycloak url from Config::: " + propsKernel.getProperty(IAM_EXTERNAL_URL) + "/auth");
logger.info("keycloak url is:::" + iam_external_url + "/auth");
return iam_external_url + "/auth";
}
//
public static String getIAMRealmId() {
return iam_realm_id;
}


//
public static String getIAMUsersToCreate() {
return iam_users_to_create;
}
Expand All @@ -684,6 +645,14 @@ public static String getRolesForUser(String userId) {
propsKernel = getproperty(TestRunner.getResourcePath() + "/" + "config/Kernel.properties");
return propsKernel.getProperty("roles." + userId);
}

public static String getIAMUrl() {
logger.info("keycloak url from ENV::: " + System.getenv(IAM_EXTERNAL_URL) + "/auth");
logger.info("keycloak url from Property::: " + System.getProperty(IAM_EXTERNAL_URL) + "/auth");
logger.info("keycloak url from Config::: " + propsKernel.getProperty(IAM_EXTERNAL_URL) + "/auth");
logger.info("keycloak url is:::" + iamExternalURL + "/auth");
return iamExternalURL + "/auth";
}

private static Properties getproperty(String path) {
Properties prop = new Properties();
Expand Down

0 comments on commit 9c6c3b0

Please sign in to comment.