diff --git a/next-ui/.env.development b/next-ui/.env.development new file mode 100644 index 00000000..df672c46 --- /dev/null +++ b/next-ui/.env.development @@ -0,0 +1 @@ +VITE_KOMGA_API_URL=http://localhost:8080 diff --git a/next-ui/src/api/komga-client.ts b/next-ui/src/api/komga-client.ts index 4e7f24bc..b2f9151a 100644 --- a/next-ui/src/api/komga-client.ts +++ b/next-ui/src/api/komga-client.ts @@ -35,7 +35,7 @@ const coladaMiddleware: Middleware = { } const client = createClient({ - baseUrl: 'http://localhost:8080', + baseUrl: import.meta.env.VITE_KOMGA_API_URL, // required to pass the session cookie on all requests credentials: 'include', // required to avoid browser basic-auth popups diff --git a/next-ui/src/vite-env.d.ts b/next-ui/src/vite-env.d.ts new file mode 100644 index 00000000..eae3ada0 --- /dev/null +++ b/next-ui/src/vite-env.d.ts @@ -0,0 +1,15 @@ +/// + +interface ViteTypeOptions { + // By adding this line, you can make the type of ImportMetaEnv strict + // to disallow unknown keys. + strictImportMetaEnv: unknown +} + +interface ImportMetaEnv { + readonly VITE_KOMGA_API_URL: string +} + +interface ImportMeta { + readonly env: ImportMetaEnv +}