This commit is contained in:
Liam 2022-10-26 13:57:48 +01:00
parent 86d7b77140
commit 8bcb7c1c5f
5 changed files with 44 additions and 19 deletions

View File

@ -1,10 +1,10 @@
HTTP_PROXY=https://proxy.fascinated.cc
NEXT_PUBLIC_HTTP_PROXY=https://proxy.fascinated.cc
SITE_NAME=BeatSaber Overlay
SITE_TITLE=BeatSaber Overlay - Simple and easy to use BeatSaber overlay
SITE_DESCRIPTION=Free, simple, and easy to use beat saber overlay for OBS
SITE_COLOR=#0EBFE9
SITE_URL=https://bs-overlay.fascinated.cc
NEXT_PUBLIC_SITE_NAME=BeatSaber Overlay
NEXT_PUBLIC_SITE_TITLE=BeatSaber Overlay - Simple and easy to use BeatSaber overlay
NEXT_PUBLIC_SITE_DESCRIPTION=Free, simple, and easy to use beat saber overlay for OBS
NEXT_PUBLIC_SITE_COLOR=#0EBFE9
NEXT_PUBLIC_SITE_URL=https://bs-overlay.fascinated.cc
REDIS_PORT=6379
REDIS_HOST=127.0.0.1

View File

@ -25,7 +25,17 @@ COPY . .
# Uncomment the following line in case you want to disable telemetry during the build.
ENV NEXT_TELEMETRY_DISABLED 1
RUN yarn build
RUN \
NEXT_PUBLIC_HTTP_PROXY=APP_NEXT_PUBLIC_HTTP_PROXY \
NEXT_PUBLIC_SITE_NAME=APP_NEXT_PUBLIC_SITE_NAME \
NEXT_PUBLIC_SITE_TITLE=APP_NEXT_PUBLIC_SITE_TITLE \
NEXT_PUBLIC_SITE_DESCRIPTION=APP_NEXT_PUBLIC_SITE_DESCRIPTION \
NEXT_PUBLIC_SITE_COLOR=APP_NEXT_NEXT_PUBLIC_SITE_COLOR \
NEXT_PUBLIC_SITE_URL=APP_NEXT_PUBLIC_SITE_URL \
yarn build
ENTRYPOINT ["/app/entrypoint.sh"]
# If using npm comment out above and use below instead
# RUN npm run build

25
entrypoint.sh Normal file
View File

@ -0,0 +1,25 @@
#!/bin/sh
echo "Check that we have NEXT_PUBLIC_API_URL vars"
test -n "$NEXT_PUBLIC_HTTP_PROXY"
echo "Check that we have NEXT_PUBLIC_SITE_NAME vars"
test -n "$NEXT_PUBLIC_SITE_NAME"
echo "Check that we have NEXT_PUBLIC_SITE_TITLE vars"
test -n "$NEXT_PUBLIC_SITE_TITLE"
echo "Check that we have NEXT_PUBLIC_SITE_DESCRIPTION vars"
test -n "$NEXT_PUBLIC_SITE_DESCRIPTION"
echo "Check that we have NEXT_PUBLIC_SITE_COLOR vars"
test -n "$NEXT_PUBLIC_SITE_COLOR"
echo "Check that we have NEXT_PUBLIC_SITE_URL vars"
test -n "$NEXT_PUBLIC_SITE_URL"
find /app/.next \( -type d -name .git -prune \) -o -type f -print0 | xargs -0 sed -i \
"s#APP_NEXT_PUBLIC_HTTP_PROXY#$NEXT_PUBLIC_HTTP_PROXY#g" \
"s#APP_NEXT_PUBLIC_SITE_NAME#$NEXT_PUBLIC_SITE_NAME#g" \
"s#APP_NEXT_PUBLIC_SITE_TITLE#$NEXT_PUBLIC_SITE_TITLE#g" \
"s#APP_NEXT_PUBLIC_SITE_DESCRIPTION#$NEXT_PUBLIC_SITE_DESCRIPTION#g" \
"s#APP_NEXT_NEXT_PUBLIC_SITE_COLOR#$NEXT_PUBLIC_SITE_COLOR#g" \
"s#APP_NEXT_NEXT_PUBLIC_SITE_URL#$NEXT_NEXT_PUBLIC_SITE_URL#g" \
echo "Starting NextJS"
exec "$@"

View File

@ -8,14 +8,6 @@ const nextConfig = {
images: {
domains: ["cdn.scoresaber.com", "*.cdn.beatsaver.com", "cdn.fascinated.cc"],
},
publicRuntimeConfig: {
httpProxy: process.env.HTTP_PROXY,
siteName: process.env.SITE_NAME,
siteTitle: process.env.SITE_TITLE,
siteDescription: process.env.SITE_DESCRIPTION,
siteColor: process.env.SITE_COLOR,
siteUrl: process.env.SITE_URL,
},
};
module.exports = nextConfig;

View File

@ -1,11 +1,9 @@
import getConfig from "next/config";
const { publicRuntimeConfig: config } = getConfig();
const WebsiteTypes = {
ScoreSaber: {
ApiUrl: {
PlayerData:
config.httpProxy + "/https://scoresaber.com/api/player/%s/basic",
process.env.NEXT_PUBLIC_HTTP_PROXY +
"/https://scoresaber.com/api/player/%s/basic",
MapData:
"https://scoresaber.com/api/leaderboard/by-hash/%h/info?difficulty=%d",
},