Updates
This commit is contained in:
parent
a4d65313f2
commit
ab3ca1839f
34
apps/auth-server/index.ts
Normal file
34
apps/auth-server/index.ts
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
import decrypt from "@moduletrace/datasquirel/dist/package-shared/functions/dsql/decrypt";
|
||||||
|
|
||||||
|
const AuthServerPort = 3177;
|
||||||
|
|
||||||
|
type AdminPagesAuth = {
|
||||||
|
date: number;
|
||||||
|
user_id: number;
|
||||||
|
url?: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
const server = Bun.serve({
|
||||||
|
port: AuthServerPort,
|
||||||
|
fetch(req) {
|
||||||
|
try {
|
||||||
|
const url = new URL(req.url);
|
||||||
|
const key = url.searchParams.get("key");
|
||||||
|
const srcOrigin = req.headers.get("x-original-uri");
|
||||||
|
|
||||||
|
const decryptedKey = JSON.parse(
|
||||||
|
decrypt({ encryptedString: key! }),
|
||||||
|
) as AdminPagesAuth;
|
||||||
|
|
||||||
|
return new Response("Auth Success!", {
|
||||||
|
status: 200,
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
return new Response("Auth Failed!", {
|
||||||
|
status: 401,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log(`Auth Server running at http://localhost:${server.port}/`);
|
||||||
19
run.sh
Normal file
19
run.sh
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
bun install
|
||||||
|
bun install -g pm2
|
||||||
|
|
||||||
|
# pm2 kill || echo "No Services Running"
|
||||||
|
|
||||||
|
# pm2 start apps/auth-server/index.ts --name cdr-auth-server --interpreter bun
|
||||||
|
|
||||||
|
docker run \
|
||||||
|
--name cdr-auth-server \
|
||||||
|
--hostname cdr-auth-server \
|
||||||
|
--network cdr-network \
|
||||||
|
-d -w /app \
|
||||||
|
-e DSQL_ENCRYPTION_PASSWORD=$DSQL_ENCRYPTION_PASSWORD \
|
||||||
|
-e DSQL_ENCRYPTION_SALT=$DSQL_ENCRYPTION_SALT \
|
||||||
|
--volume /root/.coderank/server:/app \
|
||||||
|
oven/bun:1.3.0-debian \
|
||||||
|
bun apps/auth-server/index.ts
|
||||||
Loading…
Reference in New Issue
Block a user