Update port to 3030 and configure dotenv for centralized secrets

This commit is contained in:
2025-12-31 04:38:45 +00:00
parent da23cc8e3a
commit fc155cac76
4 changed files with 6 additions and 37 deletions
-16
View File
@@ -1,16 +0,0 @@
# Microsoft Azure AD Configuration
CLIENT_SECRET=7aD8Q~d5K~_PzQv6KqDdrEnmyXHE60eVDpbcnaK_
TENANT_ID=3fd97ea7-b124-41f1-855f-52d8ac3b16c7
CLIENT_ID=3c846e71-9609-40e1-b458-0eb805e21b9f
REDIRECT_URI=https://pocketbase.ccllc.pro/api/oauth2-redirect
# PocketBase Configuration
PB_DB=https://pocketbase.ccllc.pro
PB_AUTH_COLLECTION=Users
#PocketBase Tables
PB_Job_Collection=Job_Info_TestEnv
PB_Notes_Collection=Notes
PB_App_Preferences_Collection=app_preferences_settings
PB_User_Preferences_Collection=user_preferences_settings
PB_Attachments_Collection=Attachments
+1
View File
@@ -12,3 +12,4 @@ Thumbs.db
# Bun/NPM cache artifacts
bun.lock
npm-debug.log*
.env
+1 -1
View File
@@ -4,7 +4,7 @@
"description": "Prism Notes: PocketBase + Microsoft Graph OAuth capture app",
"type": "module",
"scripts": {
"dev": "bun run --watch server.ts",
"dev": "PORT=3030 bun run --watch server.ts",
"start": "bun run server.ts"
},
"dependencies": {
+4 -20
View File
@@ -1,28 +1,12 @@
import { config } from 'dotenv';
import { Hono } from 'hono';
import { serveStatic } from 'hono/bun';
import { cors } from 'hono/cors';
import PocketBase from 'pocketbase';
import { ConfidentialClientApplication } from '@azure/msal-node';
import { readFileSync } from 'fs';
import { join } from 'path';
// Load env from local .env
const envPath = join(import.meta.dir, '.env');
try {
const envContent = readFileSync(envPath, 'utf-8');
envContent.split('\n').forEach(line => {
const trimmed = line.trim();
if (trimmed && !trimmed.startsWith('#')) {
const [key, ...valueParts] = trimmed.split('=');
if (key && valueParts.length > 0) {
process.env[key.trim()] = valueParts.join('=').trim();
}
}
});
console.log('✓ Loaded env from .env');
} catch (e) {
console.warn('⚠ Could not load .env:', (e as Error).message);
}
// Load secrets from absolute path (not in project directory)
config({ path: '/home/admin/secrets/.env' });
const app = new Hono();
@@ -126,7 +110,7 @@ app.get('/', async (c) => {
return c.html(html);
});
const PORT = Number(process.env.PORT || 5500);
const PORT = Number(process.env.PORT || 3030);
// Start Bun server manually to avoid Bun's auto startup banner
const server = Bun.serve({