Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Pratap2018 committed Mar 6, 2024
1 parent 561cd58 commit 05803ea
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 13 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ jobs:
GOOGLE_ARTIFACT_REPO: ${{secrets.GOOGLE_ARTIFACT_REPO}}
HYPERSIGN_JSON: ${{secrets.HYPERSIGN_JSON}}
run:
docker build -t $GOOGLE_ARTIFACT_URL/$GOOGLE_PROJECT_ID/$GOOGLE_ARTIFACT_REPO/auth-server:v5.4.0-rc.2 .
docker build -t $GOOGLE_ARTIFACT_URL/$GOOGLE_PROJECT_ID/$GOOGLE_ARTIFACT_REPO/auth-server:v5.4.0-rc.3 .

docker push $GOOGLE_ARTIFACT_URL/$GOOGLE_PROJECT_ID/$GOOGLE_ARTIFACT_REPO/auth-server:v5.4.0-rc.2
docker push $GOOGLE_ARTIFACT_URL/$GOOGLE_PROJECT_ID/$GOOGLE_ARTIFACT_REPO/auth-server:v5.4.0-rc.3

docker build -t $GOOGLE_ARTIFACT_URL/$GOOGLE_PROJECT_ID/$GOOGLE_ARTIFACT_REPO/auth-server-txn:v5.4.0-rc.2 . -f Txn.Dockerfile
docker build -t $GOOGLE_ARTIFACT_URL/$GOOGLE_PROJECT_ID/$GOOGLE_ARTIFACT_REPO/auth-server-txn:v5.4.0-rc.3 . -f Txn.Dockerfile

docker push $GOOGLE_ARTIFACT_URL/$GOOGLE_PROJECT_ID/$GOOGLE_ARTIFACT_REPO/auth-server-txn:v5.4.0-rc.2
docker push $GOOGLE_ARTIFACT_URL/$GOOGLE_PROJECT_ID/$GOOGLE_ARTIFACT_REPO/auth-server-txn:v5.4.0-rc.3

Deploy-Pipeline:
needs: [Build-Pipeline]
Expand All @@ -76,7 +76,7 @@ jobs:
- name: "Configure kubectl"
run: gcloud container clusters get-credentials hypermine-gke --region=asia-south1
- name: Replace tags
run: find .deploy/deployment.yaml -type f -exec sed -i -e "s#__LATEST_RELEASE_TAG__#v5.4.0-rc.2#" {} \;
run: find .deploy/deployment.yaml -type f -exec sed -i -e "s#__LATEST_RELEASE_TAG__#v5.4.0-rc.3#" {} \;

- name: "Replace secrets"
run: find .deploy/deployment.yaml -type f -exec sed -i ''s/__GOOGLE_ARTIFACT_URL__/${{ secrets.GOOGLE_ARTIFACT_URL }}/g'' {} \;
Expand Down
4 changes: 3 additions & 1 deletion src/routes/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,14 @@ export = (hypersign: IHypersignAuth, edvClient) => {
userId: user.email,
sequence: 0,
docId: "",
nameSpace: user.nameSpace || "default",

} as IUserModel;

console.log(
"auth:: userExistsMiddleWare() : BEfore checking if user already exists"
);
const userDocInEdv = await getUserDocIdIfUserExists(userData.userId);
const userDocInEdv = await getUserDocIdIfUserExists(userData.userId,userData.nameSpace);

console.log(
"auth:: userExistsMiddleWare() : After checking if user already exists, status " +
Expand Down
17 changes: 10 additions & 7 deletions src/routes/edvRoutes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export = (hypersign, edvClient) => {
try {
const { user, document } = req.body;
const userData: IUserModel = user as IUserModel;
userData.nameSpace= user.nameSpace || 'default';
userData.nameSpace = user.nameSpace || "default";

let response: IUserModel;
let status = 201;
Expand Down Expand Up @@ -104,8 +104,7 @@ export = (hypersign, edvClient) => {
const userEdvDoc = {
encryptedMessage: document.encryptedMessage,
userId: userData.userId,
nameSpace:userData.nameSpace

nameSpace: userData.nameSpace,
};

console.log("EncMessage " + userEdvDoc.encryptedMessage);
Expand All @@ -116,7 +115,6 @@ export = (hypersign, edvClient) => {
const edvDocument = edvClient.prepareEdvDocument(userEdvDoc, [
{ index: "content.userId", unique: true },
{ index: "content.nameSpace" },

]);
console.log(
"edvRoutest:: sync(): Before updating the db with docid " + userDocId
Expand Down Expand Up @@ -151,10 +149,15 @@ export = (hypersign, edvClient) => {
}
});

router.get("/sync/:userId", verifyJWT, async (req, res) => {
router.get("/sync/:userId/:nameSpace", verifyJWT, async (req, res) => {
try {
const { userId } = req.params;
const userDocInEdv = await getUserDocIdIfUserExists(userId, true);
const { userId, nameSpace } = req.params;

const userDocInEdv = await getUserDocIdIfUserExists(
userId,
nameSpace ? nameSpace : "default",
true
);
if (userDocInEdv.success && userDocInEdv.userDocId && userDocInEdv.data) {
console.log("All good, sending response ");
return res.status(200).json(userDocInEdv.data);
Expand Down

0 comments on commit 05803ea

Please sign in to comment.