feat: migrate to Bun-native, fix Planner task dates, remove hardcoded test values
- Remove dotenv dependency, implement lightweight Bun-native env loader - Replace Node.js fs/path with Bun file APIs (Bun.file, Bun.write) - Fix Planner task creation to use form's due date with proper UTC handling - Make table name, Planner assignee configurable via activeConfig and env vars - Remove all hardcoded test values for PROD readiness - Update NOTES.md with PROD mode checklist
This commit is contained in:
+23
-2
@@ -1,8 +1,29 @@
|
||||
|
||||
import { config } from 'dotenv';
|
||||
import { Client } from '@microsoft/microsoft-graph-client';
|
||||
|
||||
config({ path: '/home/admin/secrets/.env' });
|
||||
// Bun-native env loader
|
||||
async function loadEnv(filePath: string) {
|
||||
const file = Bun.file(filePath);
|
||||
if (!(await file.exists())) {
|
||||
console.warn(`⚠ Env file not found: ${filePath}`);
|
||||
return;
|
||||
}
|
||||
const text = await file.text();
|
||||
for (const line of text.split('\n')) {
|
||||
const trimmed = line.trim();
|
||||
if (!trimmed || trimmed.startsWith('#')) continue;
|
||||
const eqIndex = trimmed.indexOf('=');
|
||||
if (eqIndex === -1) continue;
|
||||
const key = trimmed.slice(0, eqIndex).trim();
|
||||
let value = trimmed.slice(eqIndex + 1).trim();
|
||||
if ((value.startsWith('"') && value.endsWith('"')) || (value.startsWith("'") && value.endsWith("'"))) {
|
||||
value = value.slice(1, -1);
|
||||
}
|
||||
process.env[key] = value;
|
||||
}
|
||||
}
|
||||
|
||||
await loadEnv('/home/admin/secrets/.env');
|
||||
|
||||
async function getGraphToken() {
|
||||
const tokenEndpoint = `https://login.microsoftonline.com/${process.env.TENANT_ID}/oauth2/v2.0/token`;
|
||||
|
||||
Reference in New Issue
Block a user