chore: Remove DEPLOYMENT and SUBDOMAINS_ENABLED (#5742)
This commit is contained in:
@@ -71,7 +71,7 @@ export async function signIn(
|
||||
},
|
||||
ip: ctx.request.ip,
|
||||
});
|
||||
const domain = getCookieDomain(ctx.request.hostname);
|
||||
const domain = getCookieDomain(ctx.request.hostname, env.isCloudHosted);
|
||||
const expires = addMonths(new Date(), 3);
|
||||
|
||||
// set a cookie for which service we last signed in with. This is
|
||||
@@ -85,7 +85,7 @@ export async function signIn(
|
||||
|
||||
// set a transfer cookie for the access token itself and redirect
|
||||
// to the teams subdomain if subdomains are enabled
|
||||
if (env.SUBDOMAINS_ENABLED && team.subdomain) {
|
||||
if (env.isCloudHosted && team.subdomain) {
|
||||
// get any existing sessions (teams signed in) and add this team
|
||||
const existing = getSessionsInCookie(ctx);
|
||||
const sessions = encodeURIComponent(
|
||||
|
||||
@@ -22,7 +22,7 @@ export default class AzureClient extends OAuthClient {
|
||||
refreshToken?: string;
|
||||
expiresAt: Date;
|
||||
}> {
|
||||
if (env.isCloudHosted()) {
|
||||
if (env.isCloudHosted) {
|
||||
return super.rotateToken(accessToken, refreshToken);
|
||||
}
|
||||
|
||||
|
||||
@@ -19,10 +19,10 @@ export default function fetch(
|
||||
): Promise<Response> {
|
||||
// In self-hosted, webhooks support proxying and are also allowed to connect
|
||||
// to internal services, so use fetchWithProxy without the filtering agent.
|
||||
const fetch = env.isCloudHosted() ? nodeFetch : fetchWithProxy;
|
||||
const fetch = env.isCloudHosted ? nodeFetch : fetchWithProxy;
|
||||
|
||||
return fetch(url, {
|
||||
...init,
|
||||
agent: env.isCloudHosted() ? useAgent(url) : undefined,
|
||||
agent: env.isCloudHosted ? useAgent(url) : undefined,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ export class StateStore {
|
||||
|
||||
ctx.cookies.set(this.key, state, {
|
||||
expires: addMinutes(new Date(), 10),
|
||||
domain: getCookieDomain(ctx.hostname),
|
||||
domain: getCookieDomain(ctx.hostname, env.isCloudHosted),
|
||||
});
|
||||
|
||||
callback(null, token);
|
||||
@@ -54,7 +54,7 @@ export class StateStore {
|
||||
// Destroy the one-time pad token and ensure it matches
|
||||
ctx.cookies.set(this.key, "", {
|
||||
expires: subMinutes(new Date(), 1),
|
||||
domain: getCookieDomain(ctx.hostname),
|
||||
domain: getCookieDomain(ctx.hostname, env.isCloudHosted),
|
||||
});
|
||||
|
||||
if (!token || token !== providedToken) {
|
||||
@@ -100,11 +100,11 @@ export async function getTeamFromContext(ctx: Context) {
|
||||
const domain = parseDomain(host);
|
||||
|
||||
let team;
|
||||
if (!env.isCloudHosted()) {
|
||||
if (!env.isCloudHosted) {
|
||||
team = await Team.findOne();
|
||||
} else if (domain.custom) {
|
||||
team = await Team.findOne({ where: { domain: domain.host } });
|
||||
} else if (env.SUBDOMAINS_ENABLED && domain.teamSubdomain) {
|
||||
} else if (domain.teamSubdomain) {
|
||||
team = await Team.findOne({
|
||||
where: { subdomain: domain.teamSubdomain },
|
||||
});
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import env from "@server/env";
|
||||
|
||||
export const robotsResponse = () => {
|
||||
if (env.isCloudHosted()) {
|
||||
if (env.isCloudHosted) {
|
||||
return `
|
||||
User-agent: *
|
||||
Allow: /
|
||||
|
||||
@@ -10,7 +10,7 @@ export async function checkPendingMigrations() {
|
||||
try {
|
||||
const pending = await migrations.pending();
|
||||
if (!isEmpty(pending)) {
|
||||
if (env.isCloudHosted()) {
|
||||
if (env.isCloudHosted) {
|
||||
Logger.warn(chalk.red("Migrations are pending"));
|
||||
process.exit(1);
|
||||
} else {
|
||||
@@ -34,7 +34,7 @@ export async function checkPendingMigrations() {
|
||||
}
|
||||
|
||||
export async function checkDataMigrations() {
|
||||
if (env.isCloudHosted()) {
|
||||
if (env.isCloudHosted) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user