diff --git a/bun.lock b/bun.lock index 73210c5..5962d1a 100644 --- a/bun.lock +++ b/bun.lock @@ -3,9 +3,6 @@ "workspaces": { "": { "name": "devley-license-ws", - "dependencies": { - "dotenv": "^16.5.0", - }, "devDependencies": { "@types/bun": "latest", }, @@ -21,8 +18,6 @@ "bun-types": ["bun-types@1.2.17", "", { "dependencies": { "@types/node": "*" } }, ""], - "dotenv": ["dotenv@16.5.0", "", {}, "sha512-m/C+AwOAr9/W1UOIZUo232ejMNnJAJtYQjUbHoNTBNTJSvqzzDh7vnrei3o3r3m9blf6ZoDkvcw0VmozNRFJxg=="], - "typescript": ["typescript@5.8.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, ""], "undici-types": ["undici-types@7.8.0", "", {}, ""], diff --git a/index.ts b/index.ts index ea0a885..23ae61a 100644 --- a/index.ts +++ b/index.ts @@ -1,13 +1,10 @@ -import dotenv from 'dotenv'; import { websocket } from './src/websocket'; import { ClientWSObject, type WebSocketData } from './src/types'; import terminateInstances from './src/routes/terminateInstances'; import getActiveInstances from './src/routes/getActiveInstances'; -dotenv.config(); - -const PORT = parseInt(process.env.PORT || "3000"); -const VERSION = parseFloat(process.env.VERSION || "1.8"); +const PORT = parseInt(Bun.env.PORT || "3000"); +const VERSION = parseFloat(Bun.env.VERSION || "1.8"); export const CONN_CLIENTS: Map = new Map(); diff --git a/package.json b/package.json index 09f89ef..296f22a 100644 --- a/package.json +++ b/package.json @@ -1,19 +1,16 @@ { "name": "devley-license-ws", "module": "index.ts", - "type": "module", - "private": true, - "scripts": { - "start": "bun run index.ts", - "dev": "bun --hot run index.ts" - }, "devDependencies": { "@types/bun": "latest" }, "peerDependencies": { "typescript": "^5" }, - "dependencies": { - "dotenv": "^16.5.0" - } + "private": true, + "scripts": { + "start": "bun run index.ts", + "dev": "bun --hot run index.ts" + }, + "type": "module" } diff --git a/src/auth.ts b/src/auth.ts index a52a343..28a4632 100644 --- a/src/auth.ts +++ b/src/auth.ts @@ -1,6 +1,6 @@ import { UserObject } from './types.ts'; -const DASHBOARD_URL = process.env.DASHBOARD_URL ?? ""; +const DASHBOARD_URL = Bun.env.DASHBOARD_URL ?? ""; export async function checkAuthorization({ request }: { request: Request }) { const authorization = request.headers.get('authorization') || ""; diff --git a/src/websocket.ts b/src/websocket.ts index ba0491a..13885f5 100644 --- a/src/websocket.ts +++ b/src/websocket.ts @@ -1,8 +1,8 @@ import { CONN_CLIENTS } from '../index'; import { LicenseObject, ProductObject, ClientWSObject } from './types'; -const DASHBOARD_URL = process.env.DASHBOARD_URL || ''; -const MAX_CONNECTIONS = parseInt(process.env.MAX_CONNECTIONS || "10000"); +const DASHBOARD_URL = Bun.env.DASHBOARD_URL || ''; +const MAX_CONNECTIONS = parseInt(Bun.env.MAX_CONNECTIONS || "10000"); export const websocket = { async open(ws: WebSocket, product_slug: string, product_version: number, license_key: string) {