Skip to content

Commit

Permalink
[+/-] configured env for cord_schema_url
Browse files Browse the repository at this point in the history
  • Loading branch information
VenuChoudhary001 committed Aug 24, 2023
2 parents 7be608d + f9a3122 commit 79e6ede
Show file tree
Hide file tree
Showing 9 changed files with 65 additions and 12 deletions.
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ services:
image: dockerhub/sunbird-rc-certificate-signer:${RELEASE_VERSION}
environment:
- PORT=8079
- TIME_ZONE=Asia/Kolkata
ports:
- "8079:8079"
volumes:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,6 @@ public ResponseEntity<Object> postEntity(
Map<String, Object> result = new HashMap<>();
ObjectNode newRootNode = objectMapper.createObjectNode();
newRootNode.set(entityName, rootNode);


try {
checkEntityNameInDefinitionManager(entityName);
String userId = registryHelper.authorizeManageEntity(request, entityName);
Expand All @@ -302,7 +300,6 @@ public ResponseEntity<Object> postEntity(
registryHelper.autoRaiseClaim(entityName, label, userId, null, newRootNode, emailId);
resultMap.put(dbConnectionInfoMgr.getUuidPropertyName(), label);
}

/** Anchoring schema to chain */
JsonNode np=rootNode.get("schema");
JsonNode str=new ObjectMapper().readTree(np.asText());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ public class RegistryHelper {
@Value("${notification.service.enabled}") boolean notificationEnabled;
@Value("${invite.required_validation_enabled}") boolean skipRequiredValidationForInvite = true;
@Value("${invite.signature_enabled}") boolean skipSignatureForInvite = true;
@Value("${cord.schemaURL}") String cord_schema_url;
@Autowired
private NotificationHelper notificationHelper;
@Autowired
Expand Down Expand Up @@ -224,7 +225,7 @@ public void apiHelper(JsonNode obj,String url){
*/
public void anchorSchemaAPI(JsonNode obj){
// apiHelper(obj,"http://172.24.0.1:5106/api/v1/schema");
apiHelper(obj,"http://localhost:5106/api/v1/schema"); // considering issuer agent running in local
apiHelper(obj,cord_schema_url); // considering issuer agent running in local
}


Expand Down
2 changes: 2 additions & 0 deletions java/registry/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ registry:
redis:
host: ${redis_host:localhost}
port: ${redis_port:6379}
cord:
schemaURL: ${cord_schema_url:http://localhost:5106/api/v1/schema}

workflow:
enabled: ${workflow.enable:true}
Expand Down
5 changes: 3 additions & 2 deletions services/certificate-signer/config/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ const CERTIFICATE_CONTROLLER_ID = process.env.CERTIFICATE_CONTROLLER_ID || 'http
const CERTIFICATE_ISSUER = process.env.CERTIFICATE_ISSUER || "https://sunbird.org/";
const CUSTOM_TEMPLATE_DELIMITERS = process.env.CUSTOM_TEMPLATE_DELIMITERS?.split(',') || "{{,}}".split(",");
const CACHE_CONTEXT_URLS = process.env.CACHE_CONTEXT_URLS || "";

const TIME_ZONE = process.env.TIME_ZONE;
module.exports = {
CERTIFICATE_CONTROLLER_ID,
CERTIFICATE_ISSUER,
CUSTOM_TEMPLATE_DELIMITERS,
CACHE_CONTEXT_URLS
CACHE_CONTEXT_URLS,
TIME_ZONE
};
33 changes: 33 additions & 0 deletions services/certificate-signer/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions services/certificate-signer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"handlebars-delimiters": "^1.0.0",
"jsonld-signatures": "^6.0.0",
"kafkajs": "^1.15.0",
"moment-timezone": "^0.5.43",
"mustache": "^4.2.0",
"node-cache": "^5.1.2",
"object-hash": "^3.0.0",
Expand Down
12 changes: 11 additions & 1 deletion services/certificate-signer/src/services/signerService.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const jsigs = require('jsonld-signatures');
const {Ed25519KeyPair, RSAKeyPair} = require('crypto-ld');
const {Ed25519Signature2018, RsaSignature2018} = jsigs.suites;
const {AssertionProofPurpose} = jsigs.purposes;
const {CERTIFICATE_CONTROLLER_ID, CUSTOM_TEMPLATE_DELIMITERS} = require('../../config/config');
const {CERTIFICATE_CONTROLLER_ID, CUSTOM_TEMPLATE_DELIMITERS, TIME_ZONE} = require('../../config/config');
const vc = require('vc-js');
const Handlebars = require("handlebars");
const delimiters = require('handlebars-delimiters');
Expand All @@ -15,6 +15,16 @@ delimiters(Handlebars, CUSTOM_TEMPLATE_DELIMITERS);
const {documentLoaders} = require('jsonld');
const {node: documentLoader} = documentLoaders;
const DEFAULT = "default";
const moment = require("moment-timezone");

Handlebars.registerHelper('formatTime', function (date) {
try {
if(!!TIME_ZONE) return moment.tz(date, TIME_ZONE).format();
} catch (err) {
console.log("Failed converting to timezone ", TIME_ZONE);
}
return date;
});

const KeyType = {
RSA: "RSA", ED25519: "ED25519"
Expand Down
17 changes: 12 additions & 5 deletions services/certificate-signer/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1706,11 +1706,6 @@
"resolved" "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz"
"version" "1.0.0"

"fsevents@^2.1.2", "fsevents@~2.3.2":
"integrity" "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA=="
"resolved" "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz"
"version" "2.3.2"

"function-bind@^1.1.1":
"integrity" "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A=="
"resolved" "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz"
Expand Down Expand Up @@ -3018,6 +3013,18 @@
"for-in" "^1.0.2"
"is-extendable" "^1.0.1"

"moment-timezone@^0.5.43":
"integrity" "sha512-72j3aNyuIsDxdF1i7CEgV2FfxM1r6aaqJyLB2vwb33mXYyoyLly+F1zbWqhA3/bVIoJ4szlUoMbUnVdid32NUQ=="
"resolved" "https://registry.npmjs.org/moment-timezone/-/moment-timezone-0.5.43.tgz"
"version" "0.5.43"
dependencies:
"moment" "^2.29.4"

"moment@^2.29.4":
"integrity" "sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w=="
"resolved" "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz"
"version" "2.29.4"

"ms@^2.1.1", "[email protected]":
"integrity" "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
"resolved" "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz"
Expand Down

0 comments on commit 79e6ede

Please sign in to comment.