add infiscal
Some checks failed
deploy / deploy (push) Has been cancelled

This commit is contained in:
Lee 2023-11-13 05:42:06 +00:00
parent 9c2bf54426
commit 75afdfed7d
8 changed files with 162 additions and 96 deletions

@ -1,4 +1,4 @@
SENTRY_AUTH_TOKEN=hi INFISICAL_TOKEN=hi
# Redis # Redis
REDIS_URL=redis://localhost:6379/0 REDIS_URL=redis://localhost:6379/0

5
.infisical.json Normal file

@ -0,0 +1,5 @@
{
"workspaceId": "6551ad1ded9edd83540488e0",
"defaultEnvironment": "",
"gitBranchToEnvironmentMapping": null
}

@ -1,31 +1,47 @@
const nextBuildId = require("next-build-id"); const nextBuildId = require("next-build-id");
const { withSentryConfig } = require("@sentry/nextjs"); const { withSentryConfig } = require("@sentry/nextjs");
const withBundleAnalyzer = require("@next/bundle-analyzer")({ const withBundleAnalyzer = require("@next/bundle-analyzer")({ enabled: false });
enabled: false, const infisicalClient = require("./src/secrets");
});
// Define remote patterns for images
const remotePatterns = [
{ protocol: "https", hostname: "cdn.fascinated.cc", pathname: "/**" },
{ protocol: "https", hostname: "cdn.scoresaber.com", pathname: "/**" },
{ protocol: "https", hostname: "cdn.jsdelivr.net", pathname: "/**" },
{ protocol: "https", hostname: "eu.cdn.beatsaver.com", pathname: "/**" },
{ protocol: "https", hostname: "na.cdn.beatsaver.com", pathname: "/**" },
{
protocol: "https",
hostname: "avatars.akamai.steamstatic.com",
pathname: "/**",
},
];
// Define optimized package imports
const optimizePackageImports = [
"react",
"react-dom",
"next-themes",
"react-tostify",
"websocket",
"cslx",
"chart.js",
"react-chartjs-2",
"country-list",
"@sentry/nextjs",
];
/** @type {import('next').NextConfig} */ /** @type {import('next').NextConfig} */
const nextConfig = { const nextConfig = {
generateEtags: true, generateEtags: true,
reactStrictMode: true, reactStrictMode: true,
swcMinify: true, swcMinify: true,
experimental: {
webpackBuildWorker: true,
optimizePackageImports: [
"react",
"react-dom",
"next-themes",
"react-tostify",
"websocket",
"cslx",
"chart.js",
"react-chartjs-2",
"country-list",
"@sentry/nextjs",
],
},
compress: false, compress: false,
poweredByHeader: false, poweredByHeader: false,
experimental: {
webpackBuildWorker: true,
optimizePackageImports,
},
env: { env: {
NEXT_PUBLIC_BUILD_ID: NEXT_PUBLIC_BUILD_ID:
process.env.GIT_REV || nextBuildId.sync({ dir: __dirname }), process.env.GIT_REV || nextBuildId.sync({ dir: __dirname }),
@ -37,80 +53,26 @@ const nextConfig = {
minute: "numeric", minute: "numeric",
}), }),
}, },
images: { images: { remotePatterns },
remotePatterns: [
{
protocol: "https",
hostname: "cdn.fascinated.cc",
port: "",
pathname: "/**",
},
{
protocol: "https",
hostname: "cdn.scoresaber.com",
port: "",
pathname: "/**",
},
{
protocol: "https",
hostname: "cdn.jsdelivr.net",
port: "",
pathname: "/**",
},
{
protocol: "https",
hostname: "eu.cdn.beatsaver.com",
port: "",
pathname: "/**",
},
{
protocol: "https",
hostname: "na.cdn.beatsaver.com",
port: "",
pathname: "/**",
},
{
protocol: "https",
hostname: "avatars.akamai.steamstatic.com",
port: "",
pathname: "/**",
},
],
},
}; };
module.exports = withBundleAnalyzer(nextConfig); module.exports = async () =>
withSentryConfig(
module.exports = withSentryConfig( withBundleAnalyzer(nextConfig),
module.exports, {
{ silent: true,
// For all available options, see: org: "sentry",
// https://github.com/getsentry/sentry-webpack-plugin#options project: "scoresaber-reloaded",
url: "https://sentry.fascinated.cc",
// Suppresses source map uploading logs during build authToken: (await infisicalClient.getSecret("SENTRY_AUTH_TOKEN"))
silent: true, .secretValue,
org: "sentry", dryRun: process.env.NODE_ENV !== "development",
project: "scoresaber-reloaded", },
url: "https://sentry.fascinated.cc", {
authToken: process.env.SENTRY_AUTH_TOKEN, widenClientFileUpload: false,
}, transpileClientSDK: false,
{ tunnelRoute: "/monitoring",
// For all available options, see: hideSourceMaps: true,
// https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/ disableLogger: true,
},
// Upload a larger set of source maps for prettier stack traces (increases build time) );
widenClientFileUpload: false,
// Transpiles SDK to be compatible with IE11 (increases bundle size)
transpileClientSDK: false,
// Routes browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers (increases server load)
tunnelRoute: "/monitoring",
// Hides source maps from generated client bundles
hideSourceMaps: true,
// Automatically tree-shake Sentry logger statements to reduce bundle size
disableLogger: true,
},
);

@ -30,6 +30,7 @@
"date-fns": "^2.30.0", "date-fns": "^2.30.0",
"encoding": "^0.1.13", "encoding": "^0.1.13",
"idb-keyval": "^6.2.1", "idb-keyval": "^6.2.1",
"infisical-node": "^1.5.0",
"lucide-react": "^0.292.0", "lucide-react": "^0.292.0",
"next": "14.0.2", "next": "14.0.2",
"next-build-id": "^3.0.0", "next-build-id": "^3.0.0",

84
pnpm-lock.yaml generated

@ -62,6 +62,9 @@ dependencies:
idb-keyval: idb-keyval:
specifier: ^6.2.1 specifier: ^6.2.1
version: 6.2.1 version: 6.2.1
infisical-node:
specifier: ^1.5.0
version: 1.5.0
lucide-react: lucide-react:
specifier: ^0.292.0 specifier: ^0.292.0
version: 0.292.0(react@18.2.0) version: 0.292.0(react@18.2.0)
@ -1581,6 +1584,10 @@ packages:
has-symbols: 1.0.3 has-symbols: 1.0.3
dev: true dev: true
/asynckit@0.4.0:
resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==}
dev: false
/autoprefixer@10.4.16(postcss@8.4.31): /autoprefixer@10.4.16(postcss@8.4.31):
resolution: {integrity: sha512-7vd3UC6xKp0HLfua5IjZlcXvGAGy7cBAXTg2lyQ/8WpNhd6SiZ8Be+xm3FyBSYJx5GKcpRCzBh7RH4/0dnY+uQ==} resolution: {integrity: sha512-7vd3UC6xKp0HLfua5IjZlcXvGAGy7cBAXTg2lyQ/8WpNhd6SiZ8Be+xm3FyBSYJx5GKcpRCzBh7RH4/0dnY+uQ==}
engines: {node: ^10 || ^12 || >=14} engines: {node: ^10 || ^12 || >=14}
@ -1607,6 +1614,16 @@ packages:
engines: {node: '>=4'} engines: {node: '>=4'}
dev: true dev: true
/axios@1.6.1:
resolution: {integrity: sha512-vfBmhDpKafglh0EldBEbVuoe7DyAavGSLWhuSm5ZSEKQnHhBf0xAAwybbNH1IkrJNGnS/VG4I5yxig1pCEXE4g==}
dependencies:
follow-redirects: 1.15.3
form-data: 4.0.0
proxy-from-env: 1.1.0
transitivePeerDependencies:
- debug
dev: false
/axobject-query@3.2.1: /axobject-query@3.2.1:
resolution: {integrity: sha512-jsyHu61e6N4Vbz/v18DHwWYKK0bSWLqn47eeDSKPB7m8tqMHF9YJ+mhIk2lVteyZrY8tnSj/jHOv4YiTCuCJgg==} resolution: {integrity: sha512-jsyHu61e6N4Vbz/v18DHwWYKK0bSWLqn47eeDSKPB7m8tqMHF9YJ+mhIk2lVteyZrY8tnSj/jHOv4YiTCuCJgg==}
dependencies: dependencies:
@ -1800,6 +1817,13 @@ packages:
color-string: 1.9.1 color-string: 1.9.1
dev: false dev: false
/combined-stream@1.0.8:
resolution: {integrity: sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==}
engines: {node: '>= 0.8'}
dependencies:
delayed-stream: 1.0.0
dev: false
/commander@4.1.1: /commander@4.1.1:
resolution: {integrity: sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==} resolution: {integrity: sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==}
engines: {node: '>= 6'} engines: {node: '>= 6'}
@ -1957,6 +1981,11 @@ packages:
object-keys: 1.1.1 object-keys: 1.1.1
dev: true dev: true
/delayed-stream@1.0.0:
resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==}
engines: {node: '>=0.4.0'}
dev: false
/dequal@2.0.3: /dequal@2.0.3:
resolution: {integrity: sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==} resolution: {integrity: sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==}
engines: {node: '>=6'} engines: {node: '>=6'}
@ -2025,6 +2054,11 @@ packages:
domhandler: 5.0.3 domhandler: 5.0.3
dev: false dev: false
/dotenv@16.3.1:
resolution: {integrity: sha512-IPzF4w4/Rd94bA9imS68tZBaYyBWSCE47V1RGuMrB94iyTOIEwRmVL2x/4An+6mETpLrKJ5hQkB8W4kFAadeIQ==}
engines: {node: '>=12'}
dev: false
/duplexer@0.1.2: /duplexer@0.1.2:
resolution: {integrity: sha512-jtD6YG370ZCIi/9GTaJKQxWTZD045+4R4hTk/x1UyoqadyJ9x9CgSi1RlVDQF8U2sxLLSnFkCaMihqljHIWgMg==} resolution: {integrity: sha512-jtD6YG370ZCIi/9GTaJKQxWTZD045+4R4hTk/x1UyoqadyJ9x9CgSi1RlVDQF8U2sxLLSnFkCaMihqljHIWgMg==}
dev: true dev: true
@ -2540,12 +2574,31 @@ packages:
resolution: {integrity: sha512-36yxDn5H7OFZQla0/jFJmbIKTdZAQHngCedGxiMmpNfEZM0sdEeT+WczLQrjK6D7o2aiyLYDnkw0R3JK0Qv1RQ==} resolution: {integrity: sha512-36yxDn5H7OFZQla0/jFJmbIKTdZAQHngCedGxiMmpNfEZM0sdEeT+WczLQrjK6D7o2aiyLYDnkw0R3JK0Qv1RQ==}
dev: true dev: true
/follow-redirects@1.15.3:
resolution: {integrity: sha512-1VzOtuEM8pC9SFU1E+8KfTjZyMztRsgEfwQl44z8A25uy13jSzTj6dyK2Df52iV0vgHCfBwLhDWevLn95w5v6Q==}
engines: {node: '>=4.0'}
peerDependencies:
debug: '*'
peerDependenciesMeta:
debug:
optional: true
dev: false
/for-each@0.3.3: /for-each@0.3.3:
resolution: {integrity: sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==} resolution: {integrity: sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==}
dependencies: dependencies:
is-callable: 1.2.7 is-callable: 1.2.7
dev: true dev: true
/form-data@4.0.0:
resolution: {integrity: sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==}
engines: {node: '>= 6'}
dependencies:
asynckit: 0.4.0
combined-stream: 1.0.8
mime-types: 2.1.35
dev: false
/fraction.js@4.3.7: /fraction.js@4.3.7:
resolution: {integrity: sha512-ZsDfxO51wGAXREY55a7la9LScWpwv9RxIrYABrlvOFBlH/ShPnrtsXeuUIfXKKOVicNxQ+o8JTbJvjS4M89yew==} resolution: {integrity: sha512-ZsDfxO51wGAXREY55a7la9LScWpwv9RxIrYABrlvOFBlH/ShPnrtsXeuUIfXKKOVicNxQ+o8JTbJvjS4M89yew==}
dev: true dev: true
@ -2822,6 +2875,17 @@ packages:
engines: {node: '>=0.8.19'} engines: {node: '>=0.8.19'}
dev: true dev: true
/infisical-node@1.5.0:
resolution: {integrity: sha512-mMdhhu50J7pI4Y89M2HMbNWRyRY6ian3oBIXW+pAWz1z8XWn5yT0ge6/YNXwTPKLnBuR1py+GwiNQUaqxkOXZw==}
dependencies:
axios: 1.6.1
dotenv: 16.3.1
tweetnacl: 1.0.3
tweetnacl-util: 0.15.1
transitivePeerDependencies:
- debug
dev: false
/inflight@1.0.6: /inflight@1.0.6:
resolution: {integrity: sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==} resolution: {integrity: sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==}
dependencies: dependencies:
@ -3177,6 +3241,18 @@ packages:
braces: 3.0.2 braces: 3.0.2
picomatch: 2.3.1 picomatch: 2.3.1
/mime-db@1.52.0:
resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==}
engines: {node: '>= 0.6'}
dev: false
/mime-types@2.1.35:
resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==}
engines: {node: '>= 0.6'}
dependencies:
mime-db: 1.52.0
dev: false
/mimic-response@3.1.0: /mimic-response@3.1.0:
resolution: {integrity: sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==} resolution: {integrity: sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==}
engines: {node: '>=10'} engines: {node: '>=10'}
@ -4319,6 +4395,14 @@ packages:
safe-buffer: 5.2.1 safe-buffer: 5.2.1
dev: false dev: false
/tweetnacl-util@0.15.1:
resolution: {integrity: sha512-RKJBIj8lySrShN4w6i/BonWp2Z/uxwC3h4y7xsRrpP59ZboCd0GpEVsOnMDYLMmKBpYhb5TgHzZXy7wTfYFBRw==}
dev: false
/tweetnacl@1.0.3:
resolution: {integrity: sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw==}
dev: false
/type-check@0.4.0: /type-check@0.4.0:
resolution: {integrity: sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==} resolution: {integrity: sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==}
engines: {node: '>= 0.8.0'} engines: {node: '>= 0.8.0'}

@ -3,7 +3,7 @@ import { createClient } from "redis";
let redisClient = await connectRedis(); let redisClient = await connectRedis();
async function connectRedis(): Promise<any> { async function connectRedis(): Promise<any> {
console.log("Connecting to redis"); // console.log("Connecting to redis");
const client = createClient({ const client = createClient({
url: process.env.REDIS_URL, url: process.env.REDIS_URL,
}); });

8
src/secrets.js Normal file

@ -0,0 +1,8 @@
const InfisicalClient = require("infisical-node");
const infisicalClient = new InfisicalClient({
token: process.env.INFISICAL_TOKEN,
siteURL: "https://secrets.fascinated.cc",
});
module.exports = infisicalClient;

@ -23,6 +23,12 @@
"@/*": ["./src/*"] "@/*": ["./src/*"]
} }
}, },
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], "include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx",
".next/types/**/*.ts",
"src/secrets.js"
],
"exclude": ["node_modules"] "exclude": ["node_modules"]
} }