From 42ff29c13d22d443d0b6f388a893e0851d4824d2 Mon Sep 17 00:00:00 2001 From: Sean Norwood Date: Wed, 6 Apr 2022 18:31:05 +0000 Subject: [PATCH] chore: use env var for api url --- tubearchivist/www/next.config.js | 3 +++ .../www/src/components/VideoList.tsx | 4 ++-- tubearchivist/www/src/pages/index.tsx | 19 +++++++++++-------- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/tubearchivist/www/next.config.js b/tubearchivist/www/next.config.js index 5493c33..e4066ee 100644 --- a/tubearchivist/www/next.config.js +++ b/tubearchivist/www/next.config.js @@ -1,5 +1,8 @@ /** @type {import('next').NextConfig} */ const nextConfig = { + images: { + domains: ["localhost", "tube.stiforr.tech"], + }, experimental: { runtime: "nodejs", }, diff --git a/tubearchivist/www/src/components/VideoList.tsx b/tubearchivist/www/src/components/VideoList.tsx index df2b248..21b66a8 100644 --- a/tubearchivist/www/src/components/VideoList.tsx +++ b/tubearchivist/www/src/components/VideoList.tsx @@ -43,7 +43,7 @@ export const VideoList = ({ videos }: { videos: Videos }) => { light="false" playing // TODO: Not currently working playsinline - url={`http://localhost:8000/media/${selectedVideoUrl.media_url}`} + url={`${process.env.NEXT_PUBLIC_TUBEARCHIVIST_URL}/media/${selectedVideoUrl.media_url}`} />
{
= ({ videos }) => { export default Home; export const getServerSideProps: GetServerSideProps = async (ctx) => { - const response = await fetch("http://localhost:8000/api/video/", { - headers: { - Accept: "application/json", - "Content-Type": "application/json", - Authorization: `Token b4d4330462c7fc16c51873e45579b29a1a12fc90`, - mode: "no-cors", - }, - }); + const response = await fetch( + `${process.env.NEXT_PUBLIC_TUBEARCHIVIST_URL}/api/video/`, + { + headers: { + Accept: "application/json", + "Content-Type": "application/json", + Authorization: `Token b4d4330462c7fc16c51873e45579b29a1a12fc90`, + mode: "no-cors", + }, + } + ); const videos = await response.json(); return { props: { videos } };