Skip to content

Commit 594ce92

Browse files
committed
update
1 parent 86c409f commit 594ce92

File tree

5 files changed

+119
-7
lines changed

5 files changed

+119
-7
lines changed

.github/workflows/pipeline.yaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@ name: AuthServer Build and deploy Pipeline
22

33
on:
44
push:
5-
tags:
6-
- "v[0-9]+.[0-9]+.[0-9]+"
7-
- "v[0-9]+.[0-9]+.[0-9]-rc.[0-9]+"
8-
5+
# tags:
6+
# - "v[0-9]+.[0-9]+.[0-9]+"
7+
# - "v[0-9]+.[0-9]+.[0-9]-rc.[0-9]+"
8+
branches:
9+
- "devops"
910
jobs:
1011
Build-Pipeline:
1112
runs-on: ubuntu-latest

exp/deployment.yaml

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: auth-server
5+
namespace: hypermine-development
6+
spec:
7+
replicas: 1
8+
selector:
9+
matchLabels:
10+
app: auth-server
11+
template:
12+
metadata:
13+
labels:
14+
app: auth-server
15+
spec:
16+
containers:
17+
- name: auth-server
18+
image: pratapmridha/auth-server
19+
imagePullPolicy: Always
20+
volumeMounts:
21+
- mountPath: "/data"
22+
name: auth-server-hypersign-json
23+
readOnly: false
24+
resources:
25+
limits:
26+
memory: "1Gi"
27+
cpu: "500m"
28+
ports:
29+
- containerPort: 8001
30+
env:
31+
- name: AUTH0TENANT
32+
value: "https://fidato.us.auth0.com/"
33+
- name: DATA_DIR
34+
value: data
35+
- name: DB_INMEM
36+
value: "false"
37+
- name: DB_URL
38+
value: "mongodb+srv://pratap:Pratap%[email protected]/authserver?retryWrites=true&w=majority"
39+
- name: EDV_BASE_URL
40+
value: "https://edv.hypersign.id"
41+
- name: EDV_CONFIG_DIR
42+
value: ".authserver-edv-config"
43+
- name: EDV_DID_FILE_PATH
44+
value: ".authserver-edv-config/edv-did.json"
45+
- name: EDV_ID
46+
value: "urn:uuid:2b9d8b0a-2b9d-4b0a-8b0a-2b9d8b0a2b9:wallet-prajna-edvs"
47+
- name: EDV_KEY_FILE_PATH
48+
value: ".authserver-edv-config/edv-key.json"
49+
- name: HIDNODE_REST_URL
50+
value: "https://api.prajna.hypersign.id/"
51+
- name: HIDNODE_RPC_URL
52+
value: "https://rpc.prajna.hypersign.id/"
53+
- name: HID_WALLET_MNEMONIC
54+
value: "sword comic lunar chalk runway evolve brand jungle glare opera submit promote defense unveil require yellow night hidden pupil setup fringe avocado ginger champion"
55+
- name: HOST
56+
value: "127.0.0.1"
57+
- name: LOG_LEVEL
58+
value: debug
59+
- name: MAXIMUM_DELAY
60+
value: "60000"
61+
- name: MAX_BATCH_SIZE
62+
value: "500"
63+
- name: MINIMUM_DELAY
64+
value: "5000"
65+
- name: NODE_ENV
66+
value: production
67+
- name: PORT
68+
value: "8001"
69+
- name: REDIS_HOST
70+
value: redis-stack-service.hypermine-development.svc.cluster.local
71+
- name: REDIS_PORT
72+
value: "6379"
73+
- name: SERVICE_END_POINT
74+
value: "https://authserver.hypersign.id/"
75+
- name: WHITELISTED_CORS
76+
value: '[ "https://dashboard.hypermine.in","wallet-stage.hypersign.id" , "https://whitelist.hypermine.in", "https://wallet.hypermine.in", "https://ssi.hypermine.in", "http://localhost:4999", "https://hswallet-stage.netlify.app", "https://hyperfyre.netlify.app", "https://wallet-stage.hypersign.id/", "https://hswallet-stage.netlify.app","https://wallet-prajna.hypersign.id"]'
77+
volumes:
78+
- name: auth-server-hypersign-json
79+
secret:
80+
secretName: auth-server-hypersign-json
81+
---
82+
apiVersion: v1
83+
kind: Service
84+
metadata:
85+
name: auth-server-service
86+
namespace: hypermine-development
87+
88+
spec:
89+
type: NodePort
90+
selector:
91+
app: auth-server
92+
ports:
93+
- port: 8001
94+
targetPort: 8001
95+
protocol: TCP

src/models/userModel.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,16 @@ export interface IUserModel extends Document {
55
userId: string;
66
sequence: number;
77
docId: string;
8+
nameSpace:string
89

910
}
1011

1112
const user = new Schema({
1213
userId: { type: String, required: true , unique: true },
1314
sequence: { type: Number, required: true },
1415
docId: { type: String, required: true },
16+
nameSpace: { type: String, required: true },
17+
1518
})
1619

1720

src/routes/auth.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,12 @@ function addExpirationDateMiddleware(req, res, next) {
5252
export = (hypersign: IHypersignAuth, edvClient) => {
5353
const router = Router();
5454

55-
async function getUserDocIdIfUserExists(userId) {
55+
async function getUserDocIdIfUserExists(userId, nameSpace = "default") {
5656
try {
5757
console.log("authRoutes:: getUserDocIdIfUserExists(): starts");
5858
const equals: { [key: string]: string } = {
5959
["content.userId"]: userId,
60+
["content.nameSpace"]: nameSpace,
6061
};
6162
console.log(
6263
"authRoutes:: getUserDocIdIfUserExists(): Before quering edvClient for userID " +

src/routes/edvRoutes.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,20 @@ export = (hypersign, edvClient) => {
99
userId: userData.userId,
1010
sequence: 0,
1111
docId: docId,
12+
nameSpace: userData.nameSpace ? "default" : userData.nameSpace,
1213
} as IUserModel;
1314
}
1415

15-
async function getUserDocIdIfUserExists(userId, getRawData: boolean = false) {
16+
async function getUserDocIdIfUserExists(
17+
userId,
18+
nameSpace,
19+
getRawData: boolean = false
20+
) {
1621
try {
1722
let data = null;
1823
const equals: { [key: string]: string } = {
1924
["content.userId"]: userId,
25+
["content.nameSpace"]: nameSpace,
2026
};
2127
const userDataInEdv: Array<any> = await edvClient.query(equals);
2228
if (!Array.isArray(userDataInEdv)) {
@@ -76,11 +82,17 @@ export = (hypersign, edvClient) => {
7682
);
7783
const equals: { [key: string]: string } = {
7884
["content.userId"]: userData.userId,
85+
["content.nameSpace"]: userData.nameSpace
86+
? "default"
87+
: userData.nameSpace,
7988
};
8089
const userDataInEdv: Array<any> = await edvClient.query(equals);
8190
console.log("User data in edv " + JSON.stringify(userDataInEdv));
8291

83-
const userDocInEdv = await getUserDocIdIfUserExists(userData.userId);
92+
const userDocInEdv = await getUserDocIdIfUserExists(
93+
userData.userId,
94+
userData.nameSpace
95+
);
8496
const { userDocId } = userDocInEdv;
8597
console.log(
8698
"edvRoutest:: sync(): After checking if user exists with doc id " +

0 commit comments

Comments
 (0)