The Dotenv Refactor (#2275)

* dotenv refactoring

* dotenv fixes

* Env variables cleanup

* Updates e2e variables

* Moves environment file to types

* Removes conflicting configs

* Readds missing variables

* Fixes

* More fixes

* Update .env.example

* Update yarn.lock

* Update turbo.json

* Fixes e2e

* Temp fix

* disables cache for lint

* Please work

* I'm getting desperate here.

* Matches node versions

* Take 2

* Revert "Take 2"

This reverts commit a735f47f2325c2040168e0cd99dea0fc357a791f.

* Update .env.example
This commit is contained in:
Omar López authored and GitHub committed 2022-03-25 17:39:38 -07:00
1 parent 2d7e1ccc05
commit ec58a9dd70
42 files changed
+498 -243

No files matched your search

-109
View File
@@ -1,109 +0,0 @@
# Set this value to 'agree' to accept our license:
# LICENSE: https://github.com/calendso/calendso/blob/main/LICENSE
#
# Summary of terms:
# - The codebase has to stay open source, whether it was modified or not
# - You can not repackage or sell the codebase
# - Acquire a commercial license to remove these terms by visiting: cal.com/sales
NEXT_PUBLIC_LICENSE_CONSENT=''
# ⚠️ ⚠️ ⚠️ DATABASE_URL got moved to `packages/prisma/.env.example` ⚠️ ⚠️ ⚠️
# Needed to enable Google Calendar integration and Login with Google
# @see https://github.com/calendso/calendso#obtaining-the-google-api-credentials
GOOGLE_API_CREDENTIALS='{}'
# To enable Login with Google you need to:
# 1. Set `GOOGLE_API_CREDENTIALS` above
# 2. Set `GOOGLE_LOGIN_ENABLED` to `true`
# When self-hosting please ensure you configure the Google integration as an Internal app so no one else can login to your instance
# @see https://support.google.com/cloud/answer/6158849#public-and-internal&zippy=%2Cpublic-and-internal-applications
GOOGLE_LOGIN_ENABLED=false
BASE_URL='http://localhost:3000'
NEXT_PUBLIC_APP_URL='http://localhost:3000'
JWT_SECRET='secret'
# This is used so we can bypass emails in auth flows for E2E testing
# To enable SAML login, set both these variables
# @see https://github.com/calcom/cal.com/tree/main/packages/ee#setting-up-saml-login
# SAML_DATABASE_URL="postgresql://postgres:@localhost:5450/cal-saml"
# SAML_ADMINS='[email protected]'
# If you use Heroku to deploy Postgres (or use self-signed certs for Postgres) then uncomment the follow line.
# @see https://devcenter.heroku.com/articles/connecting-heroku-postgres#connecting-in-node-js
##PGSSLMODE='no-verify'
# @see: https://github.com/calendso/calendso/issues/263
# Required for Vercel hosting - set NEXTAUTH_URL to equal your BASE_URL
# NEXTAUTH_URL='http://localhost:3000'
# Remove this var if you don't want Cal to collect anonymous usage
NEXT_PUBLIC_TELEMETRY_KEY=js.2pvs2bbpqq1zxna97wcml.oi2jzirnbj1ev4tc57c5r
# Used for the Office 365 / Outlook.com Calendar integration
MS_GRAPH_CLIENT_ID=
MS_GRAPH_CLIENT_SECRET=
# Used for the Zoom integration
ZOOM_CLIENT_ID=
ZOOM_CLIENT_SECRET=
#Used for the Daily integration
DAILY_API_KEY=
DAILY_SCALE_PLAN=''
# Used for the Tandem integration -- contact [email protected] to for API access.
TANDEM_CLIENT_ID=""
TANDEM_CLIENT_SECRET=""
TANDEM_BASE_URL="https://tandem.chat"
# E-mail settings
# Cal uses nodemailer (@see https://nodemailer.com/about/) to provide email sending. As such we are trying to
# allow access to the nodemailer transports from the .env file. E-mail templates are accessible within lib/emails/
# Configures the global From: header whilst sending emails.
EMAIL_FROM='[email protected]'
# Configure SMTP settings (@see https://nodemailer.com/smtp/).
# Note: The below configuration for Office 365 has been verified to work.
EMAIL_SERVER_HOST='smtp.office365.com'
EMAIL_SERVER_PORT=587
EMAIL_SERVER_USER='<office365_emailAddress>'
# Keep in mind that if you have 2FA enabled, you will need to provision an App Password.
EMAIL_SERVER_PASSWORD='<office365_password>'
# The following configuration for Gmail has been verified to work.
# EMAIL_SERVER_HOST='smtp.gmail.com'
# EMAIL_SERVER_PORT=465
# EMAIL_SERVER_USER='<gmail_emailAddress>'
## You will need to provision an App Password.
## @see https://support.google.com/accounts/answer/185833
# EMAIL_SERVER_PASSWORD='<gmail_app_password>'
# ApiKey for cronjobs
CRON_API_KEY='0cc0e6c35519bba620c9360cfe3e68d0'
# Stripe Config
NEXT_PUBLIC_STRIPE_PUBLIC_KEY= # pk_test_...
STRIPE_PRIVATE_KEY= # sk_test_...
STRIPE_CLIENT_ID= # ca_...
STRIPE_WEBHOOK_SECRET= # whsec_...
PAYMENT_FEE_PERCENTAGE=0.005 # Take 0.5% commission
PAYMENT_FEE_FIXED=10 # Take 10 additional cents commission
# Application Key for symmetric encryption and decryption
# must be 32 bytes for AES256 encryption algorithm
CALENDSO_ENCRYPTION_KEY=
# Intercom Config
NEXT_PUBLIC_INTERCOM_APP_ID=
# Zendesk Config
NEXT_PUBLIC_ZENDESK_KEY=
# Help Scout Config
NEXT_PUBLIC_HELPSCOUT_KEY=
# Set it to "1" if you need to run E2E tests locally
NEXT_PUBLIC_IS_E2E=
+3 -8
View File
@@ -298,7 +298,7 @@ export default function Shell(props: {
</div>
<small style={{ fontSize: "0.5rem" }} className="mx-3 mt-1 mb-2 hidden opacity-50 lg:block">
&copy; {new Date().getFullYear()} Cal.com, Inc. v.{pkg.version + "-"}
{process.env.NEXT_PUBLIC_APP_URL === "https://cal.com" ? "h" : "sh"}
{process.env.NEXT_PUBLIC_WEBSITE_URL === "https://cal.com" ? "h" : "sh"}
<span className="lowercase">-{user && user.plan}</span>
</small>
</div>
@@ -437,12 +437,7 @@ function UserDropdown({ small }: { small?: boolean }) {
)}>
<img
className="rounded-full"
src={
(process.env.NEXT_PUBLIC_APP_URL || process.env.NEXT_PUBLIC_BASE_URL) +
"/" +
user?.username +
"/avatar.png"
}
src={process.env.NEXT_PUBLIC_WEBSITE_URL + "/" + user?.username + "/avatar.png"}
alt={user?.username || "Nameless User"}
/>
{!user?.away && (
@@ -496,7 +491,7 @@ function UserDropdown({ small }: { small?: boolean }) {
<a
target="_blank"
rel="noopener noreferrer"
href={`${process.env.NEXT_PUBLIC_APP_URL}/${user.username}`}
href={`${process.env.NEXT_PUBLIC_WEBSITE_URL}/${user.username}`}
className="flex items-center px-4 py-2 text-sm text-gray-700">
<ExternalLinkIcon className="h-5 w-5 text-gray-500 ltr:mr-3 rtl:ml-3" /> {t("view_public_page")}
</a>
@@ -139,7 +139,7 @@ const AvailabilityPage = ({ profile, eventType, workingHours, previousPage }: Pr
.filter((user) => user.name !== profile.name)
.map((user) => ({
title: user.name,
image: `${process.env.NEXT_PUBLIC_APP_URL}/${user.username}/avatar.png`,
image: `${process.env.NEXT_PUBLIC_WEBSITE_URL}/${user.username}/avatar.png`,
alt: user.name || undefined,
})),
].filter((item) => !!item.image) as { image: string; alt?: string; title?: string }[]
@@ -189,7 +189,7 @@ const AvailabilityPage = ({ profile, eventType, workingHours, previousPage }: Pr
.map((user) => ({
title: user.name,
alt: user.name,
image: `${process.env.NEXT_PUBLIC_APP_URL}/${user.username}/avatar.png`,
image: `${process.env.NEXT_PUBLIC_WEBSITE_URL}/${user.username}/avatar.png`,
})),
].filter((item) => !!item.image) as { image: string; alt?: string; title?: string }[]
}
@@ -191,7 +191,7 @@ export default function CreateEventTypeButton(props: Props) {
required
addOnLeading={
<InputLeading>
{process.env.NEXT_PUBLIC_APP_URL}/{pageSlug}/
{process.env.NEXT_PUBLIC_WEBSITE_URL}/{pageSlug}/
</InputLeading>
}
{...register("slug")}
+1 -1
View File
@@ -67,7 +67,7 @@ const constructImage = (name: string, description: string, username: string): st
return (
encodeURIComponent("Meet **" + name + "** <br>" + description).replace(/'/g, "%27") +
".png?md=1&images=https%3A%2F%2Fcal.com%2Flogo-white.svg&images=" +
(process.env.NEXT_PUBLIC_APP_URL || process.env.BASE_URL) +
(process.env.NEXT_PUBLIC_WEBSITE_URL || process.env.NEXT_PUBLIC_WEBAPP_URL) +
"/" +
username +
"/avatar.png"
+3 -3
View File
@@ -72,7 +72,7 @@ export default function TeamListItem(props: Props) {
<div className="ml-3 inline-block">
<span className="text-sm font-bold text-neutral-700">{team.name}</span>
<span className="block text-xs text-gray-400">
{process.env.NEXT_PUBLIC_APP_URL}/team/{team.slug}
{process.env.NEXT_PUBLIC_WEBSITE_URL}/team/{team.slug}
</span>
</div>
</div>
@@ -112,7 +112,7 @@ export default function TeamListItem(props: Props) {
<Tooltip content={t("copy_link_team")}>
<Button
onClick={() => {
navigator.clipboard.writeText(process.env.NEXT_PUBLIC_APP_URL + "/team/" + team.slug);
navigator.clipboard.writeText(process.env.NEXT_PUBLIC_WEBSITE_URL + "/team/" + team.slug);
showToast(t("link_copied"), "success");
}}
className="h-10 w-10 transition-none"
@@ -143,7 +143,7 @@ export default function TeamListItem(props: Props) {
</DropdownMenuItem>
)}
<DropdownMenuItem>
<Link href={`${process.env.NEXT_PUBLIC_APP_URL}/team/${team.slug}`} passHref={true}>
<Link href={`${process.env.NEXT_PUBLIC_WEBSITE_URL}/team/${team.slug}`} passHref={true}>
<a target="_blank">
<Button
color="minimal"
+1 -1
View File
@@ -91,7 +91,7 @@ export default function TeamSettings(props: Props) {
id="team-url"
addOnLeading={
<span className="inline-flex items-center rounded-l-sm border border-r-0 border-gray-300 bg-gray-50 px-3 text-sm text-gray-500">
{process.env.NEXT_PUBLIC_APP_URL}/{"team/"}
{process.env.NEXT_PUBLIC_WEBSITE_URL}/{"team/"}
</span>
}
ref={teamUrlRef}
@@ -20,7 +20,7 @@ export default function TeamSettingsRightSidebar(props: { team: TeamWithMembers;
const utils = trpc.useContext();
const router = useRouter();
const permalink = `${process.env.NEXT_PUBLIC_APP_URL}/team/${props.team?.slug}`;
const permalink = `${process.env.NEXT_PUBLIC_WEBSITE_URL}/team/${props.team?.slug}`;
const deleteTeamMutation = trpc.useMutation("viewer.teams.delete", {
async onSuccess() {
@@ -16,6 +16,6 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
await upgradeTeam(session.user.id, Number(req.query.team));
// redirect to team screen
res.redirect(302, `${process.env.NEXT_PUBLIC_APP_URL}/settings/teams/${req.query.team}?upgraded=true`);
res.redirect(302, `${process.env.NEXT_PUBLIC_WEBAPP_URL}/settings/teams/${req.query.team}?upgraded=true`);
}
}
-33
View File
@@ -1,33 +0,0 @@
declare namespace NodeJS {
interface ProcessEnv {
readonly CALENDSO_ENCRYPTION_KEY: string | undefined;
readonly DATABASE_URL: string | undefined;
readonly GOOGLE_API_CREDENTIALS: string | undefined;
readonly BASE_URL: string | undefined;
readonly NEXT_PUBLIC_BASE_URL: string | undefined;
readonly NEXT_PUBLIC_APP_URL: string | undefined;
readonly JWT_SECRET: string | undefined;
readonly NEXT_PUBLIC_TELEMETRY_KEY: string | undefined;
readonly MS_GRAPH_CLIENT_ID: string | undefined;
readonly MS_GRAPH_CLIENT_SECRET: string | undefined;
readonly ZOOM_CLIENT_ID: string | undefined;
readonly ZOOM_CLIENT_SECRET: string | undefined;
readonly EMAIL_FROM: string | undefined;
readonly EMAIL_SERVER_HOST: string | undefined;
readonly EMAIL_SERVER_PORT: string | undefined;
readonly EMAIL_SERVER_USER: string | undefined;
readonly EMAIL_SERVER_PASSWORD: string | undefined;
readonly CRON_API_KEY: string | undefined;
readonly NEXT_PUBLIC_STRIPE_PUBLIC_KEY: string | undefined;
readonly STRIPE_PRIVATE_KEY: string | undefined;
readonly STRIPE_CLIENT_ID: string | undefined;
readonly STRIPE_WEBHOOK_SECRET: string | undefined;
readonly PAYMENT_FEE_PERCENTAGE: number | undefined;
readonly PAYMENT_FEE_FIXED: number | undefined;
readonly CALENDSO_ENCRYPTION_KEY: string | undefined;
readonly NEXT_PUBLIC_INTERCOM_APP_ID: string | undefined;
readonly TANDEM_CLIENT_ID: string | undefined;
readonly TANDEM_CLIENT_SECRET: string | undefined;
readonly TANDEM_BASE_URL: string | undefined;
}
}
@@ -59,7 +59,7 @@ ${this.getWhen()}
${this.getLocation()}
${this.getAdditionalNotes()}
${this.calEvent.organizer.language.translate("confirm_or_reject_request")}
${process.env.BASE_URL} + "/bookings/upcoming"
${process.env.NEXT_PUBLIC_WEBAPP_URL} + "/bookings/upcoming"
`.replace(/(<([^>]+)>)/gi, "");
}
@@ -167,7 +167,7 @@ ${process.env.BASE_URL} + "/bookings/upcoming"
protected getManageLink(): string {
const manageText = this.calEvent.organizer.language.translate("confirm_or_reject_request");
const manageLink = process.env.BASE_URL + "/bookings/upcoming";
const manageLink = process.env.NEXT_PUBLIC_WEBAPP_URL + "/bookings/upcoming";
return `<a style="color: #FFFFFF; text-decoration: none;" href="${manageLink}" target="_blank">${manageText} <img src="${linkIcon()}" width="12px"></img></a>`;
}
}
@@ -59,7 +59,7 @@ ${this.getWhen()}
${this.getLocation()}
${this.getAdditionalNotes()}
${this.calEvent.organizer.language.translate("confirm_or_reject_request")}
${process.env.BASE_URL} + "/bookings/upcoming"
${process.env.NEXT_PUBLIC_WEBAPP_URL} + "/bookings/upcoming"
`.replace(/(<([^>]+)>)/gi, "");
}
@@ -166,7 +166,7 @@ ${process.env.BASE_URL} + "/bookings/upcoming"
protected getManageLink(): string {
const manageText = this.calEvent.organizer.language.translate("confirm_or_reject_request");
const manageLink = process.env.BASE_URL + "/bookings/upcoming";
const manageLink = process.env.NEXT_PUBLIC_WEBAPP_URL + "/bookings/upcoming";
return `<a style="color: #FFFFFF; text-decoration: none;" href="${manageLink}" target="_blank">${manageText} <img src="${linkIcon()}" width="12px"></img></a>`;
}
}
+18 -15
View File
@@ -1,3 +1,5 @@
require("dotenv").config({ path: "../../.env" });
const withTM = require("next-transpile-modules")([
"@calcom/app-store",
"@calcom/core",
@@ -10,16 +12,15 @@ const withTM = require("next-transpile-modules")([
const { i18n } = require("./next-i18next.config");
// So we can test deploy previews preview
if (process.env.VERCEL_URL && !process.env.BASE_URL) {
process.env.BASE_URL = "https://" + process.env.VERCEL_URL;
if (process.env.VERCEL_URL && !process.env.NEXT_PUBLIC_WEBAPP_URL) {
process.env.NEXT_PUBLIC_WEBAPP_URL = "https://" + process.env.VERCEL_URL;
}
if (process.env.BASE_URL) {
process.env.NEXTAUTH_URL = process.env.BASE_URL + "/api/auth";
if (process.env.NEXT_PUBLIC_WEBAPP_URL) {
process.env.NEXTAUTH_URL = process.env.NEXT_PUBLIC_WEBAPP_URL + "/api/auth";
}
if (!process.env.NEXT_PUBLIC_APP_URL) {
process.env.NEXT_PUBLIC_APP_URL = process.env.BASE_URL;
if (!process.env.NEXT_PUBLIC_WEBSITE_URL) {
process.env.NEXT_PUBLIC_WEBSITE_URL = process.env.NEXT_PUBLIC_WEBAPP_URL;
}
process.env.NEXT_PUBLIC_BASE_URL = process.env.BASE_URL;
if (!process.env.EMAIL_FROM) {
console.warn(
@@ -60,8 +61,8 @@ if (process.env.ANALYZE === "true") {
plugins.push(withTM);
// prettier-ignore
module.exports = () => plugins.reduce((acc, next) => next(acc), {
/** @type {import("next").NextConfig} */
const nextConfig = {
i18n,
eslint: {
// This allows production builds to successfully complete even if the project has ESLint errors.
@@ -85,7 +86,7 @@ module.exports = () => plugins.reduce((acc, next) => next(acc), {
source: "/:user/avatar.png",
destination: "/api/user/avatar?username=:user",
},
]
];
},
async redirects() {
return [
@@ -100,10 +101,12 @@ module.exports = () => plugins.reduce((acc, next) => next(acc), {
permanent: true,
},
{
source: '/call/:path*',
destination: '/video/:path*',
permanent: false
}
source: "/call/:path*",
destination: "/video/:path*",
permanent: false,
},
];
},
});
};
module.exports = () => plugins.reduce((acc, next) => next(acc), nextConfig);
+2 -2
View File
@@ -39,7 +39,7 @@ export default function Custom404() {
const isSubpage = router.asPath.includes("/", 2);
const isSignup = router.asPath.includes("/signup");
const isCalcom = process.env.NEXT_PUBLIC_BASE_URL === "https://app.cal.com";
const isCalcom = process.env.NEXT_PUBLIC_WEBAPP_URL === "https://app.cal.com";
return (
<>
@@ -53,7 +53,7 @@ export default function Custom404() {
/>
<div className="min-h-screen bg-white px-4" data-testid="404-page">
<main className="mx-auto max-w-xl pt-16 pb-6 sm:pt-24">
{isSignup && process.env.NEXT_PUBLIC_BASE_URL !== "https://app.cal.com" ? (
{isSignup && process.env.NEXT_PUBLIC_WEBAPP_URL !== "https://app.cal.com" ? (
<div>
<div>
<p className="text-sm font-semibold uppercase tracking-wide text-black">
+3 -3
View File
@@ -55,7 +55,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
passwordRequest = createdResetPasswordRequest;
}
const resetLink = `${process.env.BASE_URL}/auth/forgot-password/${passwordRequest.id}`;
const resetLink = `${process.env.NEXT_PUBLIC_WEBAPP_URL}/auth/forgot-password/${passwordRequest.id}`;
const passwordEmail: PasswordReset = {
language: t,
user: maybeUser,
@@ -67,9 +67,9 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
/** So we can test the password reset flow on CI */
if (process.env.NEXT_PUBLIC_IS_E2E) {
return res.status(201).json({ message: "Reset Requested", resetLink });
} else {
return res.status(201).json({ message: "Reset Requested" });
}
return res.status(201).json({ message: "Reset Requested" });
} catch (reason) {
// console.error(reason);
return res.status(500).json({ message: "Unable to create password reset request" });
+1 -1
View File
@@ -31,7 +31,7 @@ function IframeEmbedContainer() {
// doesn't need suspense as it should already be loaded
const user = trpc.useQuery(["viewer.me"]).data;
const iframeTemplate = `<iframe src="${process.env.NEXT_PUBLIC_BASE_URL}/${user?.username}" frameborder="0" allowfullscreen></iframe>`;
const iframeTemplate = `<iframe src="${process.env.NEXT_PUBLIC_WEBAPP_URL}/${user?.username}" frameborder="0" allowfullscreen></iframe>`;
const htmlTemplate = `<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>${t(
"schedule_a_meeting"
)}</title><style>body {margin: 0;}iframe {height: calc(100vh - 4px);width: calc(100vw - 4px);box-sizing: border-box;}</style></head><body>${iframeTemplate}</body></html>`;
@@ -2,6 +2,7 @@ import debounce from "lodash/debounce";
import { GetServerSidePropsContext } from "next";
import { getCsrfToken } from "next-auth/react";
import Link from "next/link";
import { useRouter } from "next/router";
import React, { SyntheticEvent } from "react";
import Button from "@calcom/ui/Button";
@@ -18,6 +19,7 @@ export default function ForgotPassword({ csrfToken }: { csrfToken: string }) {
const [error, setError] = React.useState<{ message: string } | null>(null);
const [success, setSuccess] = React.useState(false);
const [email, setEmail] = React.useState("");
const router = useRouter();
const handleChange = (e: SyntheticEvent) => {
const target = e.target as typeof e.target & { value: string };
@@ -38,7 +40,7 @@ export default function ForgotPassword({ csrfToken }: { csrfToken: string }) {
if (!res.ok) {
setError(json);
} else if ("resetLink" in json) {
window.location = json.resetLink;
router.push(json.resetLink);
} else {
setSuccess(true);
}
+4 -4
View File
@@ -9,12 +9,12 @@ import { useForm } from "react-hook-form";
import { Alert } from "@calcom/ui/Alert";
import Button from "@calcom/ui/Button";
import { EmailField, PasswordField, Form } from "@calcom/ui/form/fields";
import { EmailField, Form, PasswordField } from "@calcom/ui/form/fields";
import { ErrorCode, getSession } from "@lib/auth";
import { WEBSITE_URL } from "@lib/config/constants";
import { WEBAPP_URL, WEBSITE_URL } from "@lib/config/constants";
import { useLocale } from "@lib/hooks/useLocale";
import { isSAMLLoginEnabled, hostedCal, samlTenantID, samlProductID } from "@lib/saml";
import { hostedCal, isSAMLLoginEnabled, samlProductID, samlTenantID } from "@lib/saml";
import { collectPageParameters, telemetryEventTypes, useTelemetry } from "@lib/telemetry";
import { inferSSRProps } from "@lib/types/inferSSRProps";
@@ -64,7 +64,7 @@ export default function Login({
// If not absolute URL, make it absolute
if (/"\//.test(callbackUrl)) callbackUrl = callbackUrl.substring(1);
if (!/^https?:\/\//.test(callbackUrl)) {
callbackUrl = `${WEBSITE_URL}/${callbackUrl}`;
callbackUrl = `${WEBAPP_URL}/${callbackUrl}`;
}
const LoginFooter = (
+1 -1
View File
@@ -91,7 +91,7 @@ export default function Signup({ email }: Props) {
<TextField
addOnLeading={
<span className="inline-flex items-center rounded-l-sm border border-r-0 border-gray-300 bg-gray-50 px-3 text-sm text-gray-500">
{process.env.NEXT_PUBLIC_APP_URL}/
{process.env.NEXT_PUBLIC_WEBSITE_URL}/
</span>
}
labelProps={{ className: "block text-sm font-medium text-gray-700" }}
+2 -2
View File
@@ -158,8 +158,8 @@ const getStripePremiumUsernameUrl = async ({
quantity: 1,
},
],
success_url: `${process.env.NEXT_PUBLIC_APP_BASE_URL}${successDestination}&session_id={CHECKOUT_SESSION_ID}`,
cancel_url: process.env.NEXT_PUBLIC_APP_BASE_URL || "https://app.cal.com",
success_url: `${process.env.NEXT_PUBLIC_WEBAPP_URL}${successDestination}&session_id={CHECKOUT_SESSION_ID}`,
cancel_url: process.env.NEXT_PUBLIC_WEBAPP_URL || "https://app.cal.com",
allow_promotion_codes: true,
});
+4 -4
View File
@@ -393,7 +393,7 @@ const EventTypePage = (props: inferSSRProps<typeof getServerSideProps>) => {
endDate: new Date(eventType.periodEndDate || Date.now()),
});
const permalink = `${process.env.NEXT_PUBLIC_APP_URL}/${
const permalink = `${process.env.NEXT_PUBLIC_WEBSITE_URL}/${
team ? `team/${team.slug}` : eventType.users[0].username
}/${eventType.slug}`;
@@ -408,7 +408,7 @@ const EventTypePage = (props: inferSSRProps<typeof getServerSideProps>) => {
}) => ({
value: `${id || ""}`,
label: `${name || ""}`,
avatar: `${process.env.NEXT_PUBLIC_APP_URL}/${username}/avatar.png`,
avatar: `${process.env.NEXT_PUBLIC_WEBSITE_URL}/${username}/avatar.png`,
});
const formMethods = useForm<{
@@ -895,7 +895,7 @@ const EventTypePage = (props: inferSSRProps<typeof getServerSideProps>) => {
<div className="w-full">
<div className="flex rounded-sm shadow-sm">
<span className="inline-flex items-center rounded-l-sm border border-r-0 border-gray-300 bg-gray-50 px-3 text-sm text-gray-500">
{process.env.NEXT_PUBLIC_APP_URL?.replace(/^(https?:|)\/\//, "")}/
{process.env.NEXT_PUBLIC_WEBSITE_URL?.replace(/^(https?:|)\/\//, "")}/
{team ? "team/" + team.slug : eventType.users[0].username}/
</span>
<input
@@ -1994,7 +1994,7 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>
const teamMembers = eventTypeObject.team
? eventTypeObject.team.members.map((member) => {
const user = member.user;
user.avatar = `${process.env.NEXT_PUBLIC_APP_URL}/${user.username}/avatar.png`;
user.avatar = `${process.env.NEXT_PUBLIC_WEBSITE_URL}/${user.username}/avatar.png`;
return user;
})
: [];
+9 -8
View File
@@ -223,13 +223,13 @@ export const EventTypeList = ({ group, readOnly, types }: EventTypeListProps): J
truncateAfter={4}
items={type.users.map((organizer) => ({
alt: organizer.name || "",
image: `${process.env.NEXT_PUBLIC_APP_URL}/${organizer.username}/avatar.png`,
image: `${process.env.NEXT_PUBLIC_WEBSITE_URL}/${organizer.username}/avatar.png`,
}))}
/>
)}
<Tooltip content={t("preview")}>
<a
href={`${process.env.NEXT_PUBLIC_APP_URL}/${group.profile.slug}/${type.slug}`}
href={`${process.env.NEXT_PUBLIC_WEBSITE_URL}/${group.profile.slug}/${type.slug}`}
target="_blank"
rel="noreferrer"
className="btn-icon appearance-none">
@@ -242,7 +242,7 @@ export const EventTypeList = ({ group, readOnly, types }: EventTypeListProps): J
onClick={() => {
showToast(t("link_copied"), "success");
navigator.clipboard.writeText(
`${process.env.NEXT_PUBLIC_APP_URL}/${group.profile.slug}/${type.slug}`
`${process.env.NEXT_PUBLIC_WEBSITE_URL}/${group.profile.slug}/${type.slug}`
);
}}
className="btn-icon">
@@ -320,7 +320,8 @@ export const EventTypeList = ({ group, readOnly, types }: EventTypeListProps): J
</DropdownMenuTrigger>
<DropdownMenuContent portalled>
<DropdownMenuItem>
<Link href={`${process.env.NEXT_PUBLIC_APP_URL}/${group.profile.slug}/${type.slug}`}>
<Link
href={`${process.env.NEXT_PUBLIC_WEBSITE_URL}/${group.profile.slug}/${type.slug}`}>
<a target="_blank">
<Button
color="minimal"
@@ -342,7 +343,7 @@ export const EventTypeList = ({ group, readOnly, types }: EventTypeListProps): J
StartIcon={ClipboardCopyIcon}
onClick={() => {
navigator.clipboard.writeText(
`${process.env.NEXT_PUBLIC_APP_URL}/${group.profile.slug}/${type.slug}`
`${process.env.NEXT_PUBLIC_WEBSITE_URL}/${group.profile.slug}/${type.slug}`
);
showToast(t("link_copied"), "success");
}}>
@@ -363,7 +364,7 @@ export const EventTypeList = ({ group, readOnly, types }: EventTypeListProps): J
.share({
title: t("share"),
text: t("share_event"),
url: `${process.env.NEXT_PUBLIC_APP_URL}/${group.profile.slug}/${type.slug}`,
url: `${process.env.NEXT_PUBLIC_WEBSITE_URL}/${group.profile.slug}/${type.slug}`,
})
.then(() => showToast(t("link_shared"), "success"))
.catch(() => showToast(t("failed"), "error"));
@@ -463,8 +464,8 @@ const EventTypeListHeading = ({ profile, membershipCount }: EventTypeListHeading
</span>
)}
{profile?.slug && (
<Link href={`${process.env.NEXT_PUBLIC_APP_URL}/${profile.slug}`}>
<a className="block text-xs text-neutral-500">{`${process.env.NEXT_PUBLIC_APP_URL?.replace(
<Link href={`${process.env.NEXT_PUBLIC_WEBSITE_URL}/${profile.slug}`}>
<a className="block text-xs text-neutral-500">{`${process.env.NEXT_PUBLIC_WEBSITE_URL?.replace(
"https://",
""
)}/${profile.slug}`}</a>
+1 -1
View File
@@ -253,7 +253,7 @@ export default function Onboarding(props: inferSSRProps<typeof getServerSideProp
}>({ resolver: zodResolver(schema), mode: "onSubmit" });
const fetchUsername = async (username: string) => {
const response = await fetch(`${process.env.NEXT_PUBLIC_APP_URL}/api/username`, {
const response = await fetch(`${process.env.NEXT_PUBLIC_WEBSITE_URL}/api/username`, {
credentials: "include",
headers: {
"Content-Type": "application/json",
+2 -2
View File
@@ -127,7 +127,7 @@ function SettingsView(props: ComponentProps<typeof Settings> & { localeProp: str
}).catch((e) => {
console.error(`Error Removing user: ${props.user.id}, email: ${props.user.email} :`, e);
});
if (process.env.NEXT_PUBLIC_BASE_URL === "https://app.cal.com") {
if (process.env.NEXT_PUBLIC_WEBAPP_URL === "https://app.cal.com") {
signOut({ callbackUrl: "/auth/logout?survey=true" });
} else {
signOut({ callbackUrl: "/auth/logout" });
@@ -232,7 +232,7 @@ function SettingsView(props: ComponentProps<typeof Settings> & { localeProp: str
name="username"
addOnLeading={
<span className="inline-flex items-center rounded-l-sm border border-r-0 border-gray-300 bg-gray-50 px-3 text-sm text-gray-500">
{process.env.NEXT_PUBLIC_APP_URL}/
{process.env.NEXT_PUBLIC_WEBSITE_URL}/
</span>
}
ref={usernameRef}
@@ -12,7 +12,7 @@ test("Can reset forgotten password", async ({ page }) => {
page.waitForNavigation({
url: "/auth/forgot-password/*",
}),
page.press('input[type="email"]', "Enter"),
page.press('input[name="email"]', "Enter"),
]);
// Wait for page to fully load
+3 -3
View File
@@ -30,7 +30,7 @@ import { viewerTeamsRouter } from "./viewer/teams";
import { webhookRouter } from "./viewer/webhook";
const checkUsername =
process.env.NEXT_PUBLIC_APP_URL === "https://cal.com" ? checkPremiumUsername : checkRegularUsername;
process.env.NEXT_PUBLIC_WEBSITE_URL === "https://cal.com" ? checkPremiumUsername : checkRegularUsername;
// things that unauthenticated users can query about themselves
const publicViewerRouter = createRouter()
@@ -762,8 +762,8 @@ const loggedInViewerRouter = createProtectedRouter()
try {
return await apiController.config({
encodedRawMetadata,
defaultRedirectUrl: `${process.env.BASE_URL}/api/auth/saml/idp`,
redirectUrl: JSON.stringify([`${process.env.BASE_URL}/*`]),
defaultRedirectUrl: `${process.env.NEXT_PUBLIC_WEBAPP_URL}/api/auth/saml/idp`,
redirectUrl: JSON.stringify([`${process.env.NEXT_PUBLIC_WEBAPP_URL}/*`]),
tenant: teamId ? tenantPrefix + teamId : samlTenantID,
product: samlProductID,
});
+1 -3
View File
@@ -8,9 +8,7 @@
"@server/*": ["server/*"],
"@ee/*": ["ee/*"],
"@prisma/client/*": ["@calcom/prisma/client/*"]
},
"typeRoots": ["./types", "@calcom/types"],
"types": ["@types/jest"]
}
},
"include": [
"next-env.d.ts",