diff --git a/.env b/.env deleted file mode 100644 index 209dfaf..0000000 --- a/.env +++ /dev/null @@ -1 +0,0 @@ -PUBLIC_PROXY_PATH= \ No newline at end of file diff --git a/src/app.d.ts b/src/app.d.ts index e063b0e..c8086d8 100644 --- a/src/app.d.ts +++ b/src/app.d.ts @@ -16,6 +16,7 @@ declare global { // interface Platform {} } declare const __APP_VERSION__: string; + declare const __PROXYURL__: string; } export {}; diff --git a/src/lib/urlloader.ts b/src/lib/urlloader.ts index 9a50cc1..0d32423 100644 --- a/src/lib/urlloader.ts +++ b/src/lib/urlloader.ts @@ -1,6 +1,7 @@ import { appStore } from "$lib/store"; import { convertToDocModel } from "$lib/singleview/docmodel/docmodel"; -import { PUBLIC_PROXY_PATH } from "$env/static/public"; +/*global __PROXYURL__*/ +const PUBLIC_PROXY_PATH: string = __PROXYURL__; /** * loadSingleCSAF loads a single CSAF document. diff --git a/vite.config.ts b/vite.config.ts index eb10d7b..2c287ef 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -15,6 +15,7 @@ import { fileURLToPath } from "url"; const file = fileURLToPath(new URL("package.json", import.meta.url)); const json = readFileSync(file, "utf8"); const pkg = JSON.parse(json); +const dev = process.argv.includes("dev"); export default defineConfig({ server: { @@ -39,6 +40,7 @@ export default defineConfig({ } }, define: { - __APP_VERSION__: `${JSON.stringify(pkg.version)}` + __APP_VERSION__: `${JSON.stringify(pkg.version)}`, + __PROXYURL__: dev ? "/proxy/" : "" } });