From 6f1a88bc00644c532ca9435de3d6a05531eab547 Mon Sep 17 00:00:00 2001 From: Soitora Date: Fri, 1 Sep 2023 12:33:38 +0200 Subject: [PATCH] Attempt to get active Netlify url as hostname --- netlify.toml | 7 ++++++- website/src/.vitepress/config.ts | 6 ++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/netlify.toml b/netlify.toml index f709ef63..9ed15c18 100644 --- a/netlify.toml +++ b/netlify.toml @@ -4,4 +4,9 @@ [build] base = "website" publish = "src/.vitepress/dist" - command = "pnpm build" + +[context.production] + command = "VITE_HOSTNAME=$URL pnpm build" + +[context.deploy-preview] + command = "VITE_HOSTNAME=$DEPLOY_PRIME_URL pnpm build" \ No newline at end of file diff --git a/website/src/.vitepress/config.ts b/website/src/.vitepress/config.ts index 2f1643a6..31cba279 100644 --- a/website/src/.vitepress/config.ts +++ b/website/src/.vitepress/config.ts @@ -1,4 +1,4 @@ -import { defineConfig } from "vitepress"; +import { defineConfig, loadEnv } from "vitepress"; import markdownConfig from "./config/markdownConfig"; // For use with loading Markdown plugins import themeConfig from "./config/themeConfig"; // Theme related config @@ -10,7 +10,9 @@ import generateOgImages from "./config/hooks/generateOgImages"; const title = "Tachiyomi"; const description = "Read your favorite manga, webtoons, comics, and more – easier than ever on your Android."; -const hostname: string = "https://kodo.moe"; + +const env = loadEnv("", process.cwd()) +const hostname: string = env.VITE_HOSTNAME || "http://localhost:4173"; export default defineConfig({ lastUpdated: true,