Update port to 3030 and configure dotenv for centralized secrets
This commit is contained in:
@@ -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
|
|
||||||
@@ -12,3 +12,4 @@ Thumbs.db
|
|||||||
# Bun/NPM cache artifacts
|
# Bun/NPM cache artifacts
|
||||||
bun.lock
|
bun.lock
|
||||||
npm-debug.log*
|
npm-debug.log*
|
||||||
|
.env
|
||||||
|
|||||||
+1
-1
@@ -4,7 +4,7 @@
|
|||||||
"description": "Prism Notes: PocketBase + Microsoft Graph OAuth capture app",
|
"description": "Prism Notes: PocketBase + Microsoft Graph OAuth capture app",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "bun run --watch server.ts",
|
"dev": "PORT=3030 bun run --watch server.ts",
|
||||||
"start": "bun run server.ts"
|
"start": "bun run server.ts"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@@ -1,28 +1,12 @@
|
|||||||
|
import { config } from 'dotenv';
|
||||||
import { Hono } from 'hono';
|
import { Hono } from 'hono';
|
||||||
import { serveStatic } from 'hono/bun';
|
import { serveStatic } from 'hono/bun';
|
||||||
import { cors } from 'hono/cors';
|
import { cors } from 'hono/cors';
|
||||||
import PocketBase from 'pocketbase';
|
import PocketBase from 'pocketbase';
|
||||||
import { ConfidentialClientApplication } from '@azure/msal-node';
|
import { ConfidentialClientApplication } from '@azure/msal-node';
|
||||||
import { readFileSync } from 'fs';
|
|
||||||
import { join } from 'path';
|
|
||||||
|
|
||||||
// Load env from local .env
|
// Load secrets from absolute path (not in project directory)
|
||||||
const envPath = join(import.meta.dir, '.env');
|
config({ path: '/home/admin/secrets/.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);
|
|
||||||
}
|
|
||||||
|
|
||||||
const app = new Hono();
|
const app = new Hono();
|
||||||
|
|
||||||
@@ -126,7 +110,7 @@ app.get('/', async (c) => {
|
|||||||
return c.html(html);
|
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
|
// Start Bun server manually to avoid Bun's auto startup banner
|
||||||
const server = Bun.serve({
|
const server = Bun.serve({
|
||||||
|
|||||||
Reference in New Issue
Block a user