Refactor WEBMENTION_TOKEN handling: remove file-based token retrieval and use global variable
All checks were successful
Deploy / deploy (push) Successful in 1m17s

This commit is contained in:
Adrian Altner 2026-04-22 03:07:20 +02:00
parent 85f58ae557
commit 7de0a815f4
3 changed files with 19 additions and 30 deletions

View file

@ -3,13 +3,25 @@
import mdx from '@astrojs/mdx';
import sitemap from '@astrojs/sitemap';
import { defineConfig, fontProviders } from 'astro/config';
import { loadEnv } from 'vite';
import node from '@astrojs/node';
const envMode = process.env.NODE_ENV === 'production' ? 'production' : 'development';
const envVars = loadEnv(envMode, process.cwd(), '');
const WEBMENTION_TOKEN = envVars.WEBMENTION_TOKEN || process.env.WEBMENTION_TOKEN || '';
console.log(`[astro.config] loadEnv mode=${envMode} token-len=${WEBMENTION_TOKEN.length}`);
// https://astro.build/config
export default defineConfig({
site: 'https://adrian-altner.de',
vite: {
define: {
'globalThis.__WEBMENTION_TOKEN__': JSON.stringify(WEBMENTION_TOKEN),
},
},
devToolbar: {
enabled: false,
},