diff --git a/Foxnouns.Frontend/package.json b/Foxnouns.Frontend/package.json index a76a918..013e44f 100644 --- a/Foxnouns.Frontend/package.json +++ b/Foxnouns.Frontend/package.json @@ -21,6 +21,7 @@ "@types/markdown-it": "^14.1.2", "@types/sanitize-html": "^2.13.0", "bootstrap": "^5.3.3", + "dotenv": "^16.4.7", "eslint": "^9.17.0", "eslint-config-prettier": "^9.1.0", "eslint-plugin-svelte": "^2.46.1", diff --git a/Foxnouns.Frontend/pnpm-lock.yaml b/Foxnouns.Frontend/pnpm-lock.yaml index 46b0010..68beeed 100644 --- a/Foxnouns.Frontend/pnpm-lock.yaml +++ b/Foxnouns.Frontend/pnpm-lock.yaml @@ -72,6 +72,9 @@ importers: bootstrap: specifier: ^5.3.3 version: 5.3.3(@popperjs/core@2.11.8) + dotenv: + specifier: ^16.4.7 + version: 16.4.7 eslint: specifier: ^9.17.0 version: 9.17.0 diff --git a/Foxnouns.Frontend/svelte.config.js b/Foxnouns.Frontend/svelte.config.js index fcd662a..f4ddf37 100644 --- a/Foxnouns.Frontend/svelte.config.js +++ b/Foxnouns.Frontend/svelte.config.js @@ -1,5 +1,14 @@ import adapter from "@sveltejs/adapter-node"; import { vitePreprocess } from "@sveltejs/vite-plugin-svelte"; +import * as path from "node:path"; + +import { config as dotenv } from "dotenv"; +dotenv({ + path: [path.resolve(process.cwd(), ".env"), path.resolve(process.cwd(), ".env.local")], +}); + +console.log(process.env.NODE_ENV); +const isProd = process.env.NODE_ENV === "production"; /** @type {import('@sveltejs/kit').Config} */ const config = { @@ -21,6 +30,9 @@ const config = { // we only disable it during development, during building NODE_ENV == production checkOrigin: process.env.NODE_ENV !== "development", }, + paths: { + assets: isProd ? process.env.PRIVATE_ASSETS_PREFIX || "" : "", + }, }, };