-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #153 from lil-lab/feat/add-ga
Add google analytics
- Loading branch information
Showing
13 changed files
with
120 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,8 +3,7 @@ | |
import { cn } from "@/utils/cn"; | ||
import { Flex, Text } from "@radix-ui/themes"; | ||
import { RecNetLink } from "@/components/Link"; | ||
|
||
export const ReportEmailAccount = "[email protected]"; | ||
import { ReportEmailAccount } from "./not-found"; | ||
|
||
export default function NotFoundPage() { | ||
return ( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
import { cn } from "@/utils/cn"; | ||
import { Flex, Text } from "@radix-ui/themes"; | ||
import { RecNetLink } from "@/components/Link"; | ||
import { ReportEmailAccount } from "@/app/error"; | ||
|
||
export const ReportEmailAccount = "[email protected]"; | ||
|
||
export default function NotFoundPage() { | ||
return ( | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { z } from "zod"; | ||
|
||
export const clientEnvSchema = z.object({ | ||
NEXT_PUBLIC_FIREBASE_API_KEY: z.string(), | ||
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN: z.string(), | ||
NEXT_PUBLIC_FIREBASE_PROJECT_ID: z.string(), | ||
NEXT_PUBLIC_FIREBASE_APP_ID: z.string(), | ||
NEXT_PUBLIC_GA_TRACKING_ID: z.string(), | ||
}); | ||
|
||
const clientEnvRes = clientEnvSchema.safeParse({ | ||
NEXT_PUBLIC_FIREBASE_API_KEY: process.env.NEXT_PUBLIC_FIREBASE_API_KEY, | ||
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN: | ||
process.env.NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN, | ||
NEXT_PUBLIC_FIREBASE_PROJECT_ID: process.env.NEXT_PUBLIC_FIREBASE_PROJECT_ID, | ||
NEXT_PUBLIC_FIREBASE_APP_ID: process.env.NEXT_PUBLIC_FIREBASE_APP_ID, | ||
NEXT_PUBLIC_GA_TRACKING_ID: process.env.NEXT_PUBLIC_GA_TRACKING_ID, | ||
}); | ||
|
||
if (!clientEnvRes.success) { | ||
// console.error(clientEnvRes.error.issues); | ||
throw new Error("There is an error with the CLIENT environment variables"); | ||
} | ||
|
||
export const clientEnv = clientEnvRes.data; | ||
|
||
export const firebaseClientEnv = { | ||
apiKey: clientEnvRes.data.NEXT_PUBLIC_FIREBASE_API_KEY, | ||
authDomain: clientEnvRes.data.NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN, | ||
projectId: clientEnvRes.data.NEXT_PUBLIC_FIREBASE_PROJECT_ID, | ||
appId: clientEnvRes.data.NEXT_PUBLIC_FIREBASE_APP_ID, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { z } from "zod"; | ||
|
||
const serverConfigSchema = z.object({ | ||
USE_SECURE_COOKIES: z.coerce.boolean(), | ||
COOKIE_SIGNATURE_KEY: z.string(), | ||
FIREBASE_PRIVATE_KEY: z.string().transform((s) => s.replace(/\\n/gm, "\n")), | ||
FIREBASE_CLIENT_EMAIL: z.string(), | ||
CRON_SECRET: z.string(), | ||
NEXT_PUBLIC_FIREBASE_API_KEY: z.string(), | ||
NEXT_PUBLIC_FIREBASE_PROJECT_ID: z.string(), | ||
}); | ||
|
||
const serverConfigRes = serverConfigSchema.safeParse({ | ||
USE_SECURE_COOKIES: process.env.USE_SECURE_COOKIES, | ||
COOKIE_SIGNATURE_KEY: process.env.COOKIE_SIGNATURE_KEY, | ||
FIREBASE_PRIVATE_KEY: process.env.FIREBASE_PRIVATE_KEY, | ||
FIREBASE_CLIENT_EMAIL: process.env.FIREBASE_CLIENT_EMAIL, | ||
CRON_SECRET: process.env.CRON_SECRET, | ||
NEXT_PUBLIC_FIREBASE_API_KEY: process.env.NEXT_PUBLIC_FIREBASE_API_KEY, | ||
NEXT_PUBLIC_FIREBASE_PROJECT_ID: process.env.NEXT_PUBLIC_FIREBASE_PROJECT_ID, | ||
}); | ||
|
||
if (!serverConfigRes.success) { | ||
console.error(serverConfigRes.error.issues); | ||
throw new Error("There is an error with the SERVER environment variables"); | ||
process.exit(1); | ||
} | ||
|
||
export const serverEnv = serverConfigRes.data; | ||
|
||
const serverConfig = { | ||
useSecureCookies: serverConfigRes.data.USE_SECURE_COOKIES, | ||
firebaseApiKey: serverConfigRes.data.NEXT_PUBLIC_FIREBASE_API_KEY, | ||
serviceAccount: { | ||
projectId: serverConfigRes.data.NEXT_PUBLIC_FIREBASE_PROJECT_ID, | ||
clientEmail: serverConfigRes.data.FIREBASE_CLIENT_EMAIL, | ||
privateKey: serverConfigRes.data.FIREBASE_PRIVATE_KEY, | ||
}, | ||
cookieSignatureKey: serverConfigRes.data.COOKIE_SIGNATURE_KEY, | ||
}; | ||
|
||
export const authConfig = { | ||
apiKey: serverConfig.firebaseApiKey, | ||
cookieName: "AuthToken", | ||
cookieSignatureKeys: [serverConfig.cookieSignatureKey], | ||
cookieSerializeOptions: { | ||
path: "/", | ||
httpOnly: true, | ||
secure: serverConfig.useSecureCookies, // Set this to true on HTTPS environments | ||
sameSite: "lax" as const, | ||
maxAge: 12 * 60 * 60 * 24, // twelve days | ||
}, | ||
serviceAccount: serverConfig.serviceAccount, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.