Maybe finally fix public env vars
This commit is contained in:
parent
6935e411b7
commit
725aff67cb
12
.env
Normal file
12
.env
Normal file
@ -0,0 +1,12 @@
|
||||
REACT_APP_HTTP_PROXY=https://proxy.fascinated.cc
|
||||
|
||||
REACT_APP_SITE_NAME=BeatSaber Overlay
|
||||
REACT_APP_SITE_TITLE=BeatSaber Overlay - Simple and easy to use BeatSaber overlay
|
||||
REACT_APP_SITE_DESCRIPTION=Free, simple, and easy to use beat saber overlay for OBS
|
||||
REACT_APP_SITE_COLOR=0EBFE9
|
||||
REACT_APP_SITE_URL=https://bs-overlay.fascinated.cc
|
||||
|
||||
REDIS_PORT=6379
|
||||
REDIS_HOST=195.154.220.97
|
||||
REDIS_PASSWORD=zgrq2L7TmhRLvwrBcosaSLi3pMjq6x7Arz4W2M3zDHt4
|
||||
REDIS_DATABASE=0
|
@ -1,10 +1,10 @@
|
||||
NEXT_PUBLIC_HTTP_PROXY=https://proxy.fascinated.cc
|
||||
REACT_APP_HTTP_PROXY=https://proxy.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
|
||||
REACT_APP_SITE_NAME=BeatSaber Overlay
|
||||
REACT_APP_SITE_TITLE=BeatSaber Overlay - Simple and easy to use BeatSaber overlay
|
||||
REACT_APP_SITE_DESCRIPTION=Free, simple, and easy to use beat saber overlay for OBS
|
||||
REACT_APP_SITE_COLOR=0EBFE9
|
||||
REACT_APP_SITE_URL=https://bs-overlay.fascinated.cc
|
||||
|
||||
REDIS_PORT=6379
|
||||
REDIS_HOST=127.0.0.1
|
||||
|
16
Dockerfile
16
Dockerfile
@ -25,16 +25,7 @@ COPY . .
|
||||
# Uncomment the following line in case you want to disable telemetry during the build.
|
||||
ENV NEXT_TELEMETRY_DISABLED 1
|
||||
|
||||
|
||||
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
|
||||
|
||||
RUN yarn build
|
||||
|
||||
# If using npm comment out above and use below instead
|
||||
# RUN npm run build
|
||||
@ -59,9 +50,6 @@ COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
|
||||
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
|
||||
COPY --from=builder --chown=nextjs:nodejs /app/public ./.next/static
|
||||
|
||||
COPY --from=builder --chown=nextjs:nodejs /app/entrypoint.sh ./entrypoint.sh
|
||||
RUN chmod 777 /app/entrypoint.sh
|
||||
|
||||
RUN chown -R nextjs:nodejs /app
|
||||
|
||||
USER nextjs
|
||||
@ -70,5 +58,5 @@ EXPOSE 3000
|
||||
|
||||
ENV PORT 3000
|
||||
|
||||
ENTRYPOINT ["/app/entrypoint.sh"]
|
||||
ENTRYPOINT yarn react-env --env APP_ENV
|
||||
CMD ["node", "server.js"]
|
@ -1,38 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo "Checking that NEXT_PUBLIC_API_URL env-var exists"
|
||||
test -n "$NEXT_PUBLIC_HTTP_PROXY"
|
||||
echo "Found $NEXT_PUBLIC_HTTP_PROXY"
|
||||
|
||||
echo "Checking that NEXT_PUBLIC_SITE_NAME env-var exists"
|
||||
test -n "$NEXT_PUBLIC_SITE_NAME"
|
||||
echo "Found $NEXT_PUBLIC_SITE_NAME"
|
||||
|
||||
echo "Checking that NEXT_PUBLIC_SITE_TITLE env-var exists"
|
||||
test -n "$NEXT_PUBLIC_SITE_TITLE"
|
||||
echo "Found $NEXT_PUBLIC_SITE_TITLE"
|
||||
|
||||
echo "Checking that NEXT_PUBLIC_SITE_DESCRIPTION env-var exists"
|
||||
test -n "$NEXT_PUBLIC_SITE_DESCRIPTION"
|
||||
echo "Found $NEXT_PUBLIC_SITE_DESCRIPTION"
|
||||
|
||||
echo "Checking that NEXT_PUBLIC_SITE_COLOR env-var exists"
|
||||
test -n "$NEXT_PUBLIC_SITE_COLOR"
|
||||
echo "Found $NEXT_PUBLIC_SITE_COLOR"
|
||||
|
||||
echo "Checking that NEXT_PUBLIC_SITE_URL env-var exists"
|
||||
test -n "$NEXT_PUBLIC_SITE_URL"
|
||||
echo "Found $NEXT_PUBLIC_SITE_COLOR"
|
||||
|
||||
echo "Ignore permission errors below"
|
||||
|
||||
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"
|
||||
find /app/.next \( -type d -name .git -prune \) -o -type f -print0 | xargs -0 sed -i "s#APP_NEXT_PUBLIC_SITE_NAME#$NEXT_PUBLIC_SITE_NAME#g"
|
||||
find /app/.next \( -type d -name .git -prune \) -o -type f -print0 | xargs -0 sed -i "s#APP_NEXT_PUBLIC_SITE_TITLE#$NEXT_PUBLIC_SITE_TITLE#g"
|
||||
find /app/.next \( -type d -name .git -prune \) -o -type f -print0 | xargs -0 sed -i "s#APP_NEXT_PUBLIC_SITE_DESCRIPTION#$NEXT_PUBLIC_SITE_DESCRIPTION#g"
|
||||
find /app/.next \( -type d -name .git -prune \) -o -type f -print0 | xargs -0 sed -i "s#APP_NEXT_PUBLIC_SITE_COLOR#$NEXT_PUBLIC_SITE_COLOR#g"
|
||||
find /app/.next \( -type d -name .git -prune \) -o -type f -print0 | xargs -0 sed -i "s#APP_NEXT_PUBLIC_SITE_URL#$NEXT_PUBLIC_SITE_URL#g"
|
||||
|
||||
echo "Starting NextJS"
|
||||
exec "$@"
|
||||
|
@ -2,12 +2,13 @@
|
||||
"name": "beatsaber-overlay",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "set APP_ENV=development && next dev",
|
||||
"dev": "react-env -- next",
|
||||
"build": "next build",
|
||||
"start": "APP_ENV=production next start -p 3001",
|
||||
"lint": "next lint"
|
||||
},
|
||||
"dependencies": {
|
||||
"@beam-australia/react-env": "^3.1.1",
|
||||
"@emotion/cache": "^11.10.3",
|
||||
"@emotion/server": "^11.10.0",
|
||||
"@nextui-org/react": "^1.0.0-beta.10",
|
||||
|
1
public/__ENV.js
Normal file
1
public/__ENV.js
Normal file
@ -0,0 +1 @@
|
||||
window.__ENV = {"REACT_APP_HTTP_PROXY":"https://proxy.fascinated.cc","REACT_APP_SITE_COLOR":"0EBFE9","REACT_APP_SITE_DESCRIPTION":"Free, simple, and easy to use beat saber overlay for OBS","REACT_APP_SITE_NAME":"BeatSaber Overlay","REACT_APP_SITE_TITLE":"BeatSaber Overlay - Simple and easy to use BeatSaber overlay","REACT_APP_SITE_URL":"https://bs-overlay.fascinated.cc"};
|
@ -1,9 +1,10 @@
|
||||
import env from "@beam-australia/react-env";
|
||||
|
||||
const WebsiteTypes = {
|
||||
ScoreSaber: {
|
||||
ApiUrl: {
|
||||
PlayerData:
|
||||
process.env.NEXT_PUBLIC_HTTP_PROXY +
|
||||
"/https://scoresaber.com/api/player/%s/basic",
|
||||
env("HTTP_PROXY") + "/https://scoresaber.com/api/player/%s/basic",
|
||||
MapData:
|
||||
"https://scoresaber.com/api/leaderboard/by-hash/%h/info?difficulty=%d",
|
||||
},
|
||||
@ -17,9 +18,7 @@ const WebsiteTypes = {
|
||||
},
|
||||
BeatLeader: {
|
||||
ApiUrl: {
|
||||
PlayerData:
|
||||
process.env.NEXT_PUBLIC_HTTP_PROXY +
|
||||
"/https://api.beatleader.xyz/player/%s",
|
||||
PlayerData: env("HTTP_PROXY") + "/https://api.beatleader.xyz/player/%s",
|
||||
MapData: "https://api.beatleader.xyz/map/hash/%h",
|
||||
},
|
||||
async getMapStarCount(mapHash, mapDiff, characteristic) {
|
||||
|
@ -1,9 +1,9 @@
|
||||
import env from "@beam-australia/react-env";
|
||||
import { BeatSaverMapData } from "../types/BeatSaverMapData";
|
||||
import { getValue, setValue, valueExists } from "../utils/redisUtils";
|
||||
|
||||
const BEATSAVER_MAP_API =
|
||||
process.env.NEXT_PUBLIC_HTTP_PROXY +
|
||||
"/https://api.beatsaver.com/maps/hash/%s";
|
||||
env("HTTP_PROXY") + "/https://api.beatsaver.com/maps/hash/%s";
|
||||
|
||||
const KEY = "BS_MAP_DATA_";
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
import env from "@beam-australia/react-env";
|
||||
import { createTheme, NextUIProvider } from "@nextui-org/react";
|
||||
import { DefaultSeo } from "next-seo";
|
||||
import { ThemeProvider as NextThemesProvider } from "next-themes";
|
||||
@ -21,13 +22,13 @@ function MyApp({ Component, pageProps }) {
|
||||
return (
|
||||
<>
|
||||
<DefaultSeo
|
||||
titleTemplate={`${process.env.NEXT_PUBLIC_SITE_NAME} | %s`}
|
||||
description={process.env.NEXT_PUBLIC_SITE_DESCRIPTION}
|
||||
titleTemplate={`${env("SITE_NAME")} | %s`}
|
||||
description={env("SITE_DESCRIPTION}")}
|
||||
openGraph={{
|
||||
url: process.env.NEXT_PUBLIC_SITE_URL,
|
||||
title: process.env.NEXT_PUBLIC_SITE_NAME,
|
||||
description: process.env.NEXT_PUBLIC_SITE_DESCRIPTION,
|
||||
site_name: process.env.NEXT_PUBLIC_SITE_NAME,
|
||||
url: env("SITE_URL"),
|
||||
title: env("SITE_NAME"),
|
||||
description: env("SITE_DESCRIPTION"),
|
||||
site_name: env("SITE_NAME"),
|
||||
images: [
|
||||
{
|
||||
url: "https://cdn.fascinated.cc/fHknFPctAC.png?raw=true",
|
||||
|
@ -1,3 +1,4 @@
|
||||
import env from "@beam-australia/react-env";
|
||||
import { CssBaseline, Image } from "@nextui-org/react";
|
||||
import Document, { Head, Html, Main, NextScript } from "next/document";
|
||||
import React from "react";
|
||||
@ -15,6 +16,7 @@ class MyDocument extends Document {
|
||||
return (
|
||||
<Html lang="en">
|
||||
<Head>
|
||||
<script defer src="/__ENV.js" />
|
||||
{CssBaseline.flush()}
|
||||
|
||||
<link
|
||||
@ -27,10 +29,7 @@ class MyDocument extends Document {
|
||||
/>
|
||||
<link rel="shortcut icon" href="/favicon.ico" />
|
||||
|
||||
<meta
|
||||
name="theme-color"
|
||||
content={"#" + process.env.NEXT_PUBLIC_SITE_COLOR}
|
||||
/>
|
||||
<meta name="theme-color" content={"#" + env("SITE_COLOR")} />
|
||||
<meta
|
||||
property="og:keywords"
|
||||
content="BeatSaber,Overlay,OBS,Twitch,YouTube,BeatSaber Overlay,Github,"
|
||||
|
65
yarn.lock
65
yarn.lock
@ -17,6 +17,16 @@
|
||||
dependencies:
|
||||
regenerator-runtime "^0.13.4"
|
||||
|
||||
"@beam-australia/react-env@^3.1.1":
|
||||
version "3.1.1"
|
||||
resolved "https://registry.yarnpkg.com/@beam-australia/react-env/-/react-env-3.1.1.tgz#63cb8316861b8fbdb4b9c550a62139cd90675e40"
|
||||
integrity sha512-LdWzgqmu116t9+sOvONyB21bBmI8dm8g8s3KhnJVzCcK93GrdSisuIOtOkQPMYgenmVGTWQwWnbLAgoka/jAFw==
|
||||
dependencies:
|
||||
cross-spawn "^6.0.5"
|
||||
dotenv "^8.0.0"
|
||||
dotenv-expand "^5.1.0"
|
||||
minimist "^1.2.0"
|
||||
|
||||
"@emotion/cache@^11.10.3":
|
||||
version "11.10.3"
|
||||
resolved "https://registry.npmjs.org/@emotion/cache/-/cache-11.10.3.tgz"
|
||||
@ -1247,6 +1257,17 @@ critters@^0.0.16:
|
||||
postcss "^8.3.7"
|
||||
pretty-bytes "^5.3.0"
|
||||
|
||||
cross-spawn@^6.0.5:
|
||||
version "6.0.5"
|
||||
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4"
|
||||
integrity sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==
|
||||
dependencies:
|
||||
nice-try "^1.0.4"
|
||||
path-key "^2.0.1"
|
||||
semver "^5.5.0"
|
||||
shebang-command "^1.2.0"
|
||||
which "^1.2.9"
|
||||
|
||||
cross-spawn@^7.0.2:
|
||||
version "7.0.3"
|
||||
resolved "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz"
|
||||
@ -1394,6 +1415,16 @@ domutils@^2.8.0:
|
||||
domelementtype "^2.2.0"
|
||||
domhandler "^4.2.0"
|
||||
|
||||
dotenv-expand@^5.1.0:
|
||||
version "5.1.0"
|
||||
resolved "https://registry.yarnpkg.com/dotenv-expand/-/dotenv-expand-5.1.0.tgz#3fbaf020bfd794884072ea26b1e9791d45a629f0"
|
||||
integrity sha512-YXQl1DSa4/PQyRfgrv6aoNjhasp/p4qs9FjJ4q4cQk+8m4r6k4ZSiEyytKG8f8W9gi8WsQtIObNmKd+tMzNTmA==
|
||||
|
||||
dotenv@^8.0.0:
|
||||
version "8.6.0"
|
||||
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-8.6.0.tgz#061af664d19f7f4d8fc6e4ff9b584ce237adcb8b"
|
||||
integrity sha512-IrPdXQsk2BbzvCBGBOTmmSH5SodmqZNt4ERAZDmW4CT+tL8VtvinqywuANaFu4bOMWki16nqf0e4oC0QIaDr/g==
|
||||
|
||||
duplexer2@^0.1.2:
|
||||
version "0.1.4"
|
||||
resolved "https://registry.npmjs.org/duplexer2/-/duplexer2-0.1.4.tgz"
|
||||
@ -2325,6 +2356,11 @@ next@12:
|
||||
"@next/swc-win32-ia32-msvc" "12.3.1"
|
||||
"@next/swc-win32-x64-msvc" "12.3.1"
|
||||
|
||||
nice-try@^1.0.4:
|
||||
version "1.0.5"
|
||||
resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366"
|
||||
integrity sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==
|
||||
|
||||
node-abi@^3.3.0:
|
||||
version "3.28.0"
|
||||
resolved "https://registry.npmjs.org/node-abi/-/node-abi-3.28.0.tgz"
|
||||
@ -2485,6 +2521,11 @@ path-is-absolute@^1.0.0:
|
||||
resolved "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz"
|
||||
integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18=
|
||||
|
||||
path-key@^2.0.1:
|
||||
version "2.0.1"
|
||||
resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40"
|
||||
integrity sha512-fEHGKCSmUSDPv4uoj8AlD+joPlq3peND+HRYyxFz4KPw4z926S/b8rIuFs2FYJg3BwsxJf6A9/3eIdLaYC+9Dw==
|
||||
|
||||
path-key@^3.1.0:
|
||||
version "3.1.1"
|
||||
resolved "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz"
|
||||
@ -2761,6 +2802,11 @@ scheduler@^0.23.0:
|
||||
dependencies:
|
||||
loose-envify "^1.1.0"
|
||||
|
||||
semver@^5.5.0:
|
||||
version "5.7.1"
|
||||
resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7"
|
||||
integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==
|
||||
|
||||
semver@^6.3.0:
|
||||
version "6.3.0"
|
||||
resolved "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz"
|
||||
@ -2787,6 +2833,13 @@ sharp@^0.31.1:
|
||||
tar-fs "^2.1.1"
|
||||
tunnel-agent "^0.6.0"
|
||||
|
||||
shebang-command@^1.2.0:
|
||||
version "1.2.0"
|
||||
resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea"
|
||||
integrity sha512-EV3L1+UQWGor21OmnvojK36mhg+TyIKDh3iFBKBohr5xeXIhNBcx8oWdgkTEEQ+BEFFYdLRuqMfd5L84N1V5Vg==
|
||||
dependencies:
|
||||
shebang-regex "^1.0.0"
|
||||
|
||||
shebang-command@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz"
|
||||
@ -2794,6 +2847,11 @@ shebang-command@^2.0.0:
|
||||
dependencies:
|
||||
shebang-regex "^3.0.0"
|
||||
|
||||
shebang-regex@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3"
|
||||
integrity sha512-wpoSFAxys6b2a2wHZ1XpDSgD7N9iVjg29Ph9uV/uaP9Ex/KXlkTZTeddxDPSYQpgvzKLGJke2UU0AzoGCjNIvQ==
|
||||
|
||||
shebang-regex@^3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz"
|
||||
@ -3079,6 +3137,13 @@ which-boxed-primitive@^1.0.2:
|
||||
is-string "^1.0.5"
|
||||
is-symbol "^1.0.3"
|
||||
|
||||
which@^1.2.9:
|
||||
version "1.3.1"
|
||||
resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a"
|
||||
integrity sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==
|
||||
dependencies:
|
||||
isexe "^2.0.0"
|
||||
|
||||
which@^2.0.1:
|
||||
version "2.0.2"
|
||||
resolved "https://registry.npmjs.org/which/-/which-2.0.2.tgz"
|
||||
|
Reference in New Issue
Block a user