mirror of
https://github.com/Sonny93/my-links.git
synced 2025-12-08 22:53:25 +00:00
add env var SITE_NAME + npm update + add env checker
This commit is contained in:
@@ -5,6 +5,8 @@ import MessageManager from './MessageManager';
|
|||||||
|
|
||||||
import styles from '../styles/create.module.scss';
|
import styles from '../styles/create.module.scss';
|
||||||
|
|
||||||
|
import { config } from '../config';
|
||||||
|
|
||||||
interface FormProps {
|
interface FormProps {
|
||||||
title: string;
|
title: string;
|
||||||
errorMessage?: string;
|
errorMessage?: string;
|
||||||
@@ -32,7 +34,7 @@ export default function Form({
|
|||||||
}: FormProps) {
|
}: FormProps) {
|
||||||
return (<>
|
return (<>
|
||||||
<Head>
|
<Head>
|
||||||
<title>Superpipo — {title}</title>
|
<title>{config.siteName} — {title}</title>
|
||||||
</Head>
|
</Head>
|
||||||
<div className={`App ${styles['create-app']}`}>
|
<div className={`App ${styles['create-app']}`}>
|
||||||
<h2>{title}</h2>
|
<h2>{title}</h2>
|
||||||
|
|||||||
33
config.ts
Normal file
33
config.ts
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
// const NEXT_PUBLIC_PREFIX = 'NEXT_PUBLIC_';
|
||||||
|
|
||||||
|
// const getEnvironmentVariable = (environmentVariable: string = ''): string => {
|
||||||
|
// if (!environmentVariable.startsWith(NEXT_PUBLIC_PREFIX)) {
|
||||||
|
// throw new Error(
|
||||||
|
// `Env var must start with "${NEXT_PUBLIC_PREFIX}": ${environmentVariable}`
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
|
||||||
|
// const envVarObject = Object
|
||||||
|
// .entries(process.env)
|
||||||
|
// .map(([key, value]) => ({ name: key, value }))
|
||||||
|
// .find((env) => {
|
||||||
|
// console.log(env.name === environmentVariable);
|
||||||
|
// return env.name === environmentVariable;
|
||||||
|
// });
|
||||||
|
|
||||||
|
// console.log('envVarObject', envVarObject, process.env.NEXT_PUBLIC_SITE_NAME)
|
||||||
|
|
||||||
|
// if (!envVarObject) {
|
||||||
|
// throw new Error(
|
||||||
|
// `Couldn't find environment variable: ${environmentVariable}`
|
||||||
|
// );
|
||||||
|
// } else {
|
||||||
|
// return envVarObject.value;
|
||||||
|
// }
|
||||||
|
// };
|
||||||
|
|
||||||
|
export const config = {
|
||||||
|
siteName: process.env.NEXT_PUBLIC_SITE_NAME // getEnvironmentVariable(NEXT_PUBLIC_PREFIX + 'SITE_NAME'),
|
||||||
|
};
|
||||||
|
|
||||||
|
console.log('config', config)
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
DATABASE_URL="mysql://root:root@127.0.0.1:3306/MyDatabase"
|
DATABASE_URL="mysql://root:root@127.0.0.1:3306/MyLinks"
|
||||||
|
|
||||||
NEXTAUTH_URL=http://localhost:3000
|
NEXTAUTH_URL=http://localhost:3000
|
||||||
NEXTAUTH_URL_INTERNAL=http://localhost:3000
|
NEXTAUTH_URL_INTERNAL=http://localhost:3000
|
||||||
@@ -6,4 +6,6 @@ NEXTAUTH_URL_INTERNAL=http://localhost:3000
|
|||||||
NEXTAUTH_SECRET=
|
NEXTAUTH_SECRET=
|
||||||
|
|
||||||
GOOGLE_CLIENT_ID=
|
GOOGLE_CLIENT_ID=
|
||||||
GOOGLE_CLIENT_SECRET=
|
GOOGLE_CLIENT_SECRET=
|
||||||
|
|
||||||
|
NEXT_PUBLIC_SITE_NAME=
|
||||||
@@ -10,6 +10,5 @@ module.exports = {
|
|||||||
});
|
});
|
||||||
|
|
||||||
return config;
|
return config;
|
||||||
},
|
}
|
||||||
optimizeFonts: false
|
|
||||||
}
|
}
|
||||||
|
|||||||
5043
package-lock.json
generated
5043
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
12
package.json
12
package.json
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "superpipo-v2",
|
"name": "my-links",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "next dev",
|
"dev": "next dev",
|
||||||
@@ -11,16 +11,16 @@
|
|||||||
"@dnd-kit/core": "^5.0.3",
|
"@dnd-kit/core": "^5.0.3",
|
||||||
"@dnd-kit/sortable": "^6.0.1",
|
"@dnd-kit/sortable": "^6.0.1",
|
||||||
"@dnd-kit/utilities": "^3.1.0",
|
"@dnd-kit/utilities": "^3.1.0",
|
||||||
"@prisma/client": "^3.13.0",
|
"@prisma/client": "^4.3.1",
|
||||||
"@svgr/webpack": "^6.2.1",
|
"@svgr/webpack": "^6.2.1",
|
||||||
"axios": "^0.27.2",
|
"axios": "^0.27.2",
|
||||||
"next": "^12.1.6",
|
"next": "^12.3.0",
|
||||||
"next-auth": "^4.0.6",
|
"next-auth": "^4.0.6",
|
||||||
"next-connect": "^0.12.2",
|
"next-connect": "^0.12.2",
|
||||||
"nprogress": "^0.2.0",
|
"nprogress": "^0.2.0",
|
||||||
"react": "^18.1.0",
|
"react": "^18.2.0",
|
||||||
"react-confirm-alert": "^2.8.0",
|
"react-confirm-alert": "^2.8.0",
|
||||||
"react-dom": "^18.1.0",
|
"react-dom": "^18.2.0",
|
||||||
"react-select": "^5.3.1",
|
"react-select": "^5.3.1",
|
||||||
"sass": "^1.46.0",
|
"sass": "^1.46.0",
|
||||||
"sharp": "^0.30.4",
|
"sharp": "^0.30.4",
|
||||||
@@ -32,6 +32,6 @@
|
|||||||
"@types/react": "^18.0.8",
|
"@types/react": "^18.0.8",
|
||||||
"eslint": "7",
|
"eslint": "7",
|
||||||
"eslint-config-next": "12.0.7",
|
"eslint-config-next": "12.0.7",
|
||||||
"prisma": "^3.13.0"
|
"prisma": "^4.3.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
import Head from 'next/head';
|
import Head from 'next/head';
|
||||||
import styles from '../styles/error-page.module.scss';
|
import styles from '../styles/error-page.module.scss';
|
||||||
|
|
||||||
|
import { config } from '../config';
|
||||||
|
|
||||||
export default function Custom404() {
|
export default function Custom404() {
|
||||||
return (<>
|
return (<>
|
||||||
<Head>
|
<Head>
|
||||||
<title>Superpipo — Page introuvable</title>
|
<title>{config.siteName} — Page introuvable</title>
|
||||||
</Head>
|
</Head>
|
||||||
<div className={styles['App']}>
|
<div className={styles['App']}>
|
||||||
<h1>404</h1>
|
<h1>404</h1>
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
import Head from 'next/head';
|
import Head from 'next/head';
|
||||||
import styles from '../styles/error-page.module.scss';
|
import styles from '../styles/error-page.module.scss';
|
||||||
|
|
||||||
|
import { config } from '../config';
|
||||||
|
|
||||||
export default function Custom500() {
|
export default function Custom500() {
|
||||||
return (<>
|
return (<>
|
||||||
<Head>
|
<Head>
|
||||||
<title>Superpipo — Une erreur côté serveur est survenue</title>
|
<title>{config.siteName} — Une erreur côté serveur est survenue</title>
|
||||||
</Head>
|
</Head>
|
||||||
<div className={styles['App']}>
|
<div className={styles['App']}>
|
||||||
<h1>500</h1>
|
<h1>500</h1>
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
import { Html, Head, Main, NextScript } from 'next/document';
|
import { Html, Head, Main, NextScript } from 'next/document';
|
||||||
|
|
||||||
|
import { config } from '../config';
|
||||||
|
|
||||||
const Document = () => (
|
const Document = () => (
|
||||||
<Html lang='fr'>
|
<Html lang='fr'>
|
||||||
<Head>
|
<Head>
|
||||||
@@ -7,8 +9,9 @@ const Document = () => (
|
|||||||
href='https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,400;0,500;0,700;1,400;1,500;1,700&family=Rubik:ital,wght@0,400;0,700;1,400;1,700&display=swap'
|
href='https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,400;0,500;0,700;1,400;1,500;1,700&family=Rubik:ital,wght@0,400;0,700;1,400;1,700&display=swap'
|
||||||
rel='stylesheet'
|
rel='stylesheet'
|
||||||
/>
|
/>
|
||||||
|
<meta charSet='UTF-8' />
|
||||||
</Head>
|
</Head>
|
||||||
<title>Superpipo</title>
|
<title>{config.siteName}</title>
|
||||||
<body>
|
<body>
|
||||||
<noscript>
|
<noscript>
|
||||||
Vous devez activer JavaScript pour utiliser ce site
|
Vous devez activer JavaScript pour utiliser ce site
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import { Category, Link } from '../types';
|
|||||||
import { BuildCategory } from '../utils/front';
|
import { BuildCategory } from '../utils/front';
|
||||||
import { prisma } from '../utils/back';
|
import { prisma } from '../utils/back';
|
||||||
|
|
||||||
|
import { config } from '../config';
|
||||||
|
|
||||||
interface HomeProps {
|
interface HomeProps {
|
||||||
categories: Category[];
|
categories: Category[];
|
||||||
@@ -24,7 +25,7 @@ function Home({ categories, favorites }: HomeProps) {
|
|||||||
|
|
||||||
return (<>
|
return (<>
|
||||||
<Head>
|
<Head>
|
||||||
<title>Superpipo</title>
|
<title>{config.siteName}</title>
|
||||||
</Head>
|
</Head>
|
||||||
<div className='App'>
|
<div className='App'>
|
||||||
<Menu
|
<Menu
|
||||||
|
|||||||
@@ -7,7 +7,10 @@ import Head from 'next/head';
|
|||||||
import styles from '../styles/login.module.scss';
|
import styles from '../styles/login.module.scss';
|
||||||
import MessageManager from '../components/MessageManager';
|
import MessageManager from '../components/MessageManager';
|
||||||
|
|
||||||
export default function SignIn({ providers }) {
|
import { config } from '../config';
|
||||||
|
import { Provider } from 'next-auth/providers';
|
||||||
|
|
||||||
|
export default function SignIn({ providers }: { providers: Provider[]; }) {
|
||||||
const { data: session, status } = useSession();
|
const { data: session, status } = useSession();
|
||||||
const info = useRouter().query?.info as string;
|
const info = useRouter().query?.info as string;
|
||||||
const error = useRouter().query?.error as string;
|
const error = useRouter().query?.error as string;
|
||||||
@@ -22,7 +25,7 @@ export default function SignIn({ providers }) {
|
|||||||
|
|
||||||
return (<>
|
return (<>
|
||||||
<Head>
|
<Head>
|
||||||
<title>Superpipo — Authentification</title>
|
<title>{config.siteName} — Authentification</title>
|
||||||
</Head>
|
</Head>
|
||||||
<div className='App'>
|
<div className='App'>
|
||||||
<div className={styles['wrapper']}>
|
<div className={styles['wrapper']}>
|
||||||
|
|||||||
Reference in New Issue
Block a user