Use NEXT_PUBLIC_ prefix for base path

This commit is contained in:
Aditya Thakral 2021-06-07 21:51:02 -04:00
parent 66f9d93d8e
commit 2b733ade44
3 changed files with 4 additions and 4 deletions

View File

@ -11,7 +11,7 @@ stages:
- staging
variables:
BASE_PATH: '/~a3thakra/csc'
NEXT_PUBLIC_BASE_PATH: '/~a3thakra/csc'
install_deps:
stage: .pre
@ -43,7 +43,7 @@ deploy_staging:
stage: .post
needs: ["staging"]
script:
- 'curl -XPOST -H "Authorization: Basic $STAGING_SECRET" "https://csclub.uwaterloo.ca/$BASE_PATH"'
- 'curl -XPOST -H "Authorization: Basic $STAGING_SECRET" "https://csclub.uwaterloo.ca/~a3thakra/csc/"'
only:
refs:
- main

View File

@ -3,7 +3,7 @@ import React, { ImgHTMLAttributes } from "react";
export function Image(props: ImgHTMLAttributes<HTMLImageElement>) {
const { src: relativeSrc = "" } = props;
let absoluteSrc = process.env.BASE_PATH ?? "/";
let absoluteSrc = process.env.NEXT_PUBLIC_BASE_PATH ?? "/";
if (absoluteSrc.endsWith("/") && relativeSrc.startsWith("/")) {
absoluteSrc += relativeSrc.slice(1);
} else if (absoluteSrc.endsWith("/") || relativeSrc.startsWith("/")) {

View File

@ -5,5 +5,5 @@ const withMDX = require("@next/mdx")({
module.exports = withMDX({
pageExtensions: ["ts", "tsx", "mdx"],
trailingSlash: true,
basePath: process.env.BASE_PATH,
basePath: process.env.NEXT_PUBLIC_BASE_PATH,
});