-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add google analytics #153
Add google analytics #153
Changes from 6 commits
d5f3c2b
ea17b86
0d20f7c
6c40903
efca748
aed63b3
b81f166
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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 ( | ||
|
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.
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); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [nit] do we need this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should preserve this so that if other developers (assume we have other dev in our team) run the app on their local machine without proper |
||
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 was deleted.
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, | ||
}; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nit] change the filename to camel case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh, that makes sense but actually this is kind of a frontend convention to name this file like this.
Ref: