Skip to content

Commit 79e6ede

Browse files
[+/-] configured env for cord_schema_url
2 parents 7be608d + f9a3122 commit 79e6ede

9 files changed

Lines changed: 65 additions & 12 deletions

File tree

docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ services:
145145
image: dockerhub/sunbird-rc-certificate-signer:${RELEASE_VERSION}
146146
environment:
147147
- PORT=8079
148+
- TIME_ZONE=Asia/Kolkata
148149
ports:
149150
- "8079:8079"
150151
volumes:

java/registry/src/main/java/dev/sunbirdrc/registry/controller/RegistryEntityController.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -287,8 +287,6 @@ public ResponseEntity<Object> postEntity(
287287
Map<String, Object> result = new HashMap<>();
288288
ObjectNode newRootNode = objectMapper.createObjectNode();
289289
newRootNode.set(entityName, rootNode);
290-
291-
292290
try {
293291
checkEntityNameInDefinitionManager(entityName);
294292
String userId = registryHelper.authorizeManageEntity(request, entityName);
@@ -302,7 +300,6 @@ public ResponseEntity<Object> postEntity(
302300
registryHelper.autoRaiseClaim(entityName, label, userId, null, newRootNode, emailId);
303301
resultMap.put(dbConnectionInfoMgr.getUuidPropertyName(), label);
304302
}
305-
306303
/** Anchoring schema to chain */
307304
JsonNode np=rootNode.get("schema");
308305
JsonNode str=new ObjectMapper().readTree(np.asText());

java/registry/src/main/java/dev/sunbirdrc/registry/helper/RegistryHelper.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ public class RegistryHelper {
9393
@Value("${notification.service.enabled}") boolean notificationEnabled;
9494
@Value("${invite.required_validation_enabled}") boolean skipRequiredValidationForInvite = true;
9595
@Value("${invite.signature_enabled}") boolean skipSignatureForInvite = true;
96+
@Value("${cord.schemaURL}") String cord_schema_url;
9697
@Autowired
9798
private NotificationHelper notificationHelper;
9899
@Autowired
@@ -224,7 +225,7 @@ public void apiHelper(JsonNode obj,String url){
224225
*/
225226
public void anchorSchemaAPI(JsonNode obj){
226227
// apiHelper(obj,"http://172.24.0.1:5106/api/v1/schema");
227-
apiHelper(obj,"http://localhost:5106/api/v1/schema"); // considering issuer agent running in local
228+
apiHelper(obj,cord_schema_url); // considering issuer agent running in local
228229
}
229230

230231

java/registry/src/main/resources/application.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ registry:
6565
redis:
6666
host: ${redis_host:localhost}
6767
port: ${redis_port:6379}
68+
cord:
69+
schemaURL: ${cord_schema_url:http://localhost:5106/api/v1/schema}
6870

6971
workflow:
7072
enabled: ${workflow.enable:true}

services/certificate-signer/config/config.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@ const CERTIFICATE_CONTROLLER_ID = process.env.CERTIFICATE_CONTROLLER_ID || 'http
22
const CERTIFICATE_ISSUER = process.env.CERTIFICATE_ISSUER || "https://sunbird.org/";
33
const CUSTOM_TEMPLATE_DELIMITERS = process.env.CUSTOM_TEMPLATE_DELIMITERS?.split(',') || "{{,}}".split(",");
44
const CACHE_CONTEXT_URLS = process.env.CACHE_CONTEXT_URLS || "";
5-
5+
const TIME_ZONE = process.env.TIME_ZONE;
66
module.exports = {
77
CERTIFICATE_CONTROLLER_ID,
88
CERTIFICATE_ISSUER,
99
CUSTOM_TEMPLATE_DELIMITERS,
10-
CACHE_CONTEXT_URLS
10+
CACHE_CONTEXT_URLS,
11+
TIME_ZONE
1112
};

services/certificate-signer/package-lock.json

Lines changed: 33 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

services/certificate-signer/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"handlebars-delimiters": "^1.0.0",
1616
"jsonld-signatures": "^6.0.0",
1717
"kafkajs": "^1.15.0",
18+
"moment-timezone": "^0.5.43",
1819
"mustache": "^4.2.0",
1920
"node-cache": "^5.1.2",
2021
"object-hash": "^3.0.0",

services/certificate-signer/src/services/signerService.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const jsigs = require('jsonld-signatures');
22
const {Ed25519KeyPair, RSAKeyPair} = require('crypto-ld');
33
const {Ed25519Signature2018, RsaSignature2018} = jsigs.suites;
44
const {AssertionProofPurpose} = jsigs.purposes;
5-
const {CERTIFICATE_CONTROLLER_ID, CUSTOM_TEMPLATE_DELIMITERS} = require('../../config/config');
5+
const {CERTIFICATE_CONTROLLER_ID, CUSTOM_TEMPLATE_DELIMITERS, TIME_ZONE} = require('../../config/config');
66
const vc = require('vc-js');
77
const Handlebars = require("handlebars");
88
const delimiters = require('handlebars-delimiters');
@@ -15,6 +15,16 @@ delimiters(Handlebars, CUSTOM_TEMPLATE_DELIMITERS);
1515
const {documentLoaders} = require('jsonld');
1616
const {node: documentLoader} = documentLoaders;
1717
const DEFAULT = "default";
18+
const moment = require("moment-timezone");
19+
20+
Handlebars.registerHelper('formatTime', function (date) {
21+
try {
22+
if(!!TIME_ZONE) return moment.tz(date, TIME_ZONE).format();
23+
} catch (err) {
24+
console.log("Failed converting to timezone ", TIME_ZONE);
25+
}
26+
return date;
27+
});
1828

1929
const KeyType = {
2030
RSA: "RSA", ED25519: "ED25519"

services/certificate-signer/yarn.lock

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1706,11 +1706,6 @@
17061706
"resolved" "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz"
17071707
"version" "1.0.0"
17081708

1709-
"fsevents@^2.1.2", "fsevents@~2.3.2":
1710-
"integrity" "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA=="
1711-
"resolved" "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz"
1712-
"version" "2.3.2"
1713-
17141709
"function-bind@^1.1.1":
17151710
"integrity" "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A=="
17161711
"resolved" "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz"
@@ -3018,6 +3013,18 @@
30183013
"for-in" "^1.0.2"
30193014
"is-extendable" "^1.0.1"
30203015

3016+
"moment-timezone@^0.5.43":
3017+
"integrity" "sha512-72j3aNyuIsDxdF1i7CEgV2FfxM1r6aaqJyLB2vwb33mXYyoyLly+F1zbWqhA3/bVIoJ4szlUoMbUnVdid32NUQ=="
3018+
"resolved" "https://registry.npmjs.org/moment-timezone/-/moment-timezone-0.5.43.tgz"
3019+
"version" "0.5.43"
3020+
dependencies:
3021+
"moment" "^2.29.4"
3022+
3023+
"moment@^2.29.4":
3024+
"integrity" "sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w=="
3025+
"resolved" "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz"
3026+
"version" "2.29.4"
3027+
30213028
"ms@^2.1.1", "[email protected]":
30223029
"integrity" "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
30233030
"resolved" "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz"

0 commit comments

Comments
 (0)