Skip to content

Commit 6b1691f

Browse files
Merge branch 'Sunbird-RC:main' into upstream
2 parents 8fa528f + f9a3122 commit 6b1691f

File tree

6 files changed

+61
-8
lines changed

6 files changed

+61
-8
lines changed

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:

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)