-
Notifications
You must be signed in to change notification settings - Fork 8.4k
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
feat: Single domain setup when only one org in the system #18383
Conversation
Hey there and thank you for opening this pull request! 👋🏼 We require pull request titles to follow the Conventional Commits specification and it looks like your proposed title needs to be adjusted. Details:
|
apps/web/getSubdomainRegExp.js
Outdated
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.
Renamed to getNextjsOrgRewriteConfig and made it more robust with better tests.
* app.company.cal.com -> app | ||
* app.company.com -> app | ||
*/ | ||
const getLeftMostSubdomain = (url) => { |
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.
Renamed getDefaultSubdomain
-> getLeftMostSubdomain
return _url.hostname.match(regex)?.groups?.subdomain || null; | ||
}; | ||
|
||
const getRegExpNotMatchingLeftMostSubdomain = (url) => { |
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.
Renamed getSubdomainRegExp
-> getRegExpNotMatchingLeftMostSubdomain
apps/web/next.config.js
Outdated
@@ -124,7 +123,7 @@ const matcherConfigRootPath = { | |||
has: [ | |||
{ | |||
type: "host", | |||
value: orgHostPath, | |||
value: nextJsOrgRewriteConfig.orgHostPath, |
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.
if Single org setup isn't enabled the regex here should remain same
apps/web/next.config.js
Outdated
@@ -328,23 +328,23 @@ const nextConfig = { | |||
? [ | |||
{ | |||
...matcherConfigRootPath, | |||
destination: "/team/:orgSlug?isOrgProfile=1", | |||
destination: `/team/${orgSlug}?isOrgProfile=1`, |
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.
if single org setup isn't enabled, orgSlug = ":orgSlug"
E2E results are ready! |
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 2 Skipped Deployments
|
@calcom/foundation for next.config.js review |
Graphite Automations"Add consumer team as reviewer" took an action on this PR • (12/31/24)1 reviewer was added to this PR based on Keith Williams's automation. |
const matcherConfigRootPath = { | ||
has: [ | ||
{ | ||
type: "host", | ||
value: orgHostPath, | ||
}, | ||
], | ||
source: "/", | ||
}; | ||
|
||
const matcherConfigRootPathEmbed = { | ||
has: [ | ||
{ | ||
type: "host", | ||
value: orgHostPath, | ||
}, | ||
], |
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.
Clubbed them under a single object.
@@ -322,29 +327,33 @@ const nextConfig = { | |||
// These rewrites are other than booking pages rewrites and so that they aren't redirected to org pages ensure that they happen in beforeFiles | |||
...(isOrganizationsEnabled | |||
? [ | |||
orgDomainMatcherConfig.root |
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.
Allows to conditionally enable rewrite to organization for root path.
We disable it for single domain setup of org
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.
LGTM. Appreciate the tests as well 🙏🏽
What does this PR do?
See Readme update on how to use.
Mandatory Tasks (DO NOT REMOVE)
How should this be tested?