-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #99 from Sunbird-Lern/release-5.0.0
Release 5.0.0 - Merging from release-5.0.0 to master
- Loading branch information
Showing
46 changed files
with
757 additions
and
782 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
all-actors/src/main/java/org/sunbird/RegistryCredential.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package org.sunbird; | ||
|
||
import org.apache.commons.lang3.StringUtils; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
/** | ||
* this class will help in getting the env values for calling the cert service | ||
* @author anmolgupta | ||
*/ | ||
public class RegistryCredential { | ||
|
||
private static Logger logger= LoggerFactory.getLogger(RegistryCredential.class); | ||
private static final String SERVICE_BASE_URL = getPropsFromEnvs(JsonKeys.REGISTRY_CREDENTIAL_SERVICE_BASE_URL); | ||
private static final String CERTIFICATE_TYPE = getPropsFromEnvs(JsonKeys.RC_ENTITY); | ||
private static final String API = "/api/v1/%s"; | ||
|
||
public static String getSERVICE_BASE_URL() { | ||
if(StringUtils.isBlank(SERVICE_BASE_URL)){ | ||
logger.error("RegistryCredential:getPropsFromEnvs:no suitable host found"); | ||
System.exit(-1); | ||
} | ||
return SERVICE_BASE_URL; | ||
} | ||
public static String getDOWNLOAD_URI() { | ||
return String.format(API, CERTIFICATE_TYPE); | ||
} | ||
|
||
private static String getPropsFromEnvs(String props){ | ||
String propValue = System.getenv(props); | ||
return propValue; | ||
} | ||
|
||
|
||
public static String getRCSearchUri(){ | ||
String apiUrl = String.format(API, CERTIFICATE_TYPE); | ||
String rcSearchApi = String.format("%s/%s/search", getSERVICE_BASE_URL().split(",")[0], apiUrl); | ||
logger.info("RegistryCredential:getRCSearchUri:es uri formed: "+rcSearchApi); | ||
return rcSearchApi; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.