[object Object]

← back to Dw Slideshow Gen

engine: auto-load .env (POSTIZ_API_KEY) so integrations/post work without exporting

a0d2ef6180dd1899168eb382724a52f348571a73 · 2026-06-29 10:30:52 -0700 · Steve Abrams

Files touched

Diff

commit a0d2ef6180dd1899168eb382724a52f348571a73
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Mon Jun 29 10:30:52 2026 -0700

    engine: auto-load .env (POSTIZ_API_KEY) so integrations/post work without exporting
---
 index.js | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/index.js b/index.js
index 1959b25..3610110 100644
--- a/index.js
+++ b/index.js
@@ -17,6 +17,14 @@ import { readJSON, writeJSON, ensureDir, slugify, today } from './lib/util.js'
 const ROOT = path.dirname(fileURLToPath(import.meta.url))
 const OUT = path.join(ROOT, 'output')
 
+// load .env (zero-dep) so POSTIZ_API_KEY etc. are available without exporting
+try {
+  for (const line of fs.readFileSync(path.join(ROOT, '.env'), 'utf8').split('\n')) {
+    const m = line.match(/^\s*([A-Z0-9_]+)\s*=\s*(.*)\s*$/)
+    if (m && !process.env[m[1]]) process.env[m[1]] = m[2].replace(/^["']|["']$/g, '')
+  }
+} catch {}
+
 function parseArgs(argv) {
   const a = { _: [] }
   for (let i = 0; i < argv.length; i++) {

← 05c2f1d Postiz integration: verified public-API client (integrations  ·  back to Dw Slideshow Gen  ·  auto-save: 2026-06-29T10:48:32 (4 files) — lib/post.js lib/p 5481d94 →