Switch to enviroment variables

This commit is contained in:
Liam 2022-10-20 16:13:45 +01:00
parent e3a90c33f4
commit 3cb96a539a
6 changed files with 26 additions and 28 deletions

11
.env.local-example Normal file

@ -0,0 +1,11 @@
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
HTTP_PROXY=https://proxy.fascinated.cc
REDIS_IP=127.0.0.1
REDIS_USERNAME=yes
REDIS_PASSWORD=yes
REDIS_DATABASE=0

@ -1,8 +0,0 @@
{
"name": "BeatSaber Overlay",
"title": "BeatSaber Overlay - Simple and easy to use BeatSaber overlay",
"description": "Free, simple, and easy to use beat saber overlay for OBS",
"color": "#0EBFE9",
"url": "https://bs-overlay.fascinated.cc",
"proxy_url": "https://proxy.fascinated.cc"
}

@ -1,9 +1,6 @@
import { createTheme, NextUIProvider } from "@nextui-org/react";
import { NextSeo } from "next-seo";
import { ThemeProvider as NextThemesProvider } from "next-themes";
import Config from "../config.json";
import "../styles/globals.css";
const lightTheme = createTheme({
@ -32,13 +29,13 @@ function MyApp({ Component, pageProps }) {
>
<NextUIProvider>
<NextSeo
title={Config.name}
description={Config.description}
title={process.env.SITE_NAME}
description={process.env.SITE_DESCRIPTION}
openGraph={{
url: Config.url,
title: Config.name,
description: Config.description,
site_name: Config.name,
url: process.env.SITE_URL,
title: process.env.SITE_NAME,
description: process.env.SITE_DESCRIPTION,
site_name: process.env.SITE_NAME,
images: [
{
url: "https://cdn.fascinated.cc/fHknFPctAC.png?raw=true",

@ -2,8 +2,6 @@ import { CssBaseline, Image } from "@nextui-org/react";
import Document, { Head, Html, Main, NextScript } from "next/document";
import React from "react";
import Config from "../config.json";
class MyDocument extends Document {
static async getInitialProps(ctx) {
const initialProps = await Document.getInitialProps(ctx);
@ -28,7 +26,7 @@ class MyDocument extends Document {
/>
<link rel="shortcut icon" href="/favicon.ico" />
<meta name="theme-color" content={Config.color} />
<meta name="theme-color" content={process.env.SITE_COLOR} />
<meta
property="og:keywords"
content="BeatSaber,Overlay,OBS,Twitch,YouTube,BeatSaber Overlay,Github,"

@ -1,17 +1,18 @@
import Config from "../../config.json";
const WebsiteTypes = {
ScoreSaber: {
ApiUrl: {
PlayerData:
Config.proxy_url + "/https://scoresaber.com/api/player/%s/basic",
process.env.NEXT_PUBLIC_HTTP_PROXY +
"/https://scoresaber.com/api/player/%s/basic",
},
},
BeatLeader: {
ApiUrl: {
PlayerData: Config.proxy_url + "/https://api.beatleader.xyz/player/%s",
PlayerData:
process.env.NEXT_PUBLIC_HTTP_PROXY +
"/https://api.beatleader.xyz/player/%s",
MapData:
Config.proxy_url +
process.env.NEXT_PUBLIC_HTTP_PROXY +
"/https://api.beatleader.xyz/leaderboard/hash/%h/%d/%m",
},
async getMapStarCount(mapHash, mapDiff, characteristic) {

@ -1,10 +1,9 @@
import Config from "../config.json";
const mapCache = new Map();
module.exports = {
BEATSAVER_MAP_API:
Config.proxy_url + "/https://api.beatsaver.com/maps/hash/%s",
process.env.NEXT_PUBLIC_HTTP_PROXY +
"/https://api.beatsaver.com/maps/hash/%s",
/**
* Gets a specified maps data from BeatSaver