chore: Remove DEPLOYMENT and SUBDOMAINS_ENABLED (#5742)

This commit is contained in:
Tom Moor
2023-08-28 20:39:58 -04:00
committed by GitHub
parent 7725f29dc7
commit 30a4303a8e
35 changed files with 136 additions and 135 deletions

View File

@@ -1,10 +1,14 @@
import WelcomeEmail from "@server/emails/templates/WelcomeEmail";
import env from "@server/env";
import { TeamDomain } from "@server/models";
import Collection from "@server/models/Collection";
import UserAuthentication from "@server/models/UserAuthentication";
import { buildUser, buildTeam } from "@server/test/factories";
import { setupTestDatabase, seed } from "@server/test/support";
import {
setupTestDatabase,
seed,
setCloudHosted,
setSelfHosted,
} from "@server/test/support";
import accountProvisioner from "./accountProvisioner";
setupTestDatabase();
@@ -13,9 +17,7 @@ describe("accountProvisioner", () => {
const ip = "127.0.0.1";
describe("hosted", () => {
beforeEach(() => {
env.DEPLOYMENT = "hosted";
});
beforeEach(setCloudHosted);
it("should create a new user and team", async () => {
const spy = jest.spyOn(WelcomeEmail.prototype, "schedule");
@@ -325,9 +327,7 @@ describe("accountProvisioner", () => {
});
describe("self hosted", () => {
beforeEach(() => {
env.DEPLOYMENT = undefined;
});
beforeEach(setSelfHosted);
it("should fail if existing team and domain not in allowed list", async () => {
let error;

View File

@@ -1,7 +1,10 @@
import env from "@server/env";
import TeamDomain from "@server/models/TeamDomain";
import { buildTeam, buildUser } from "@server/test/factories";
import { setupTestDatabase } from "@server/test/support";
import {
setCloudHosted,
setSelfHosted,
setupTestDatabase,
} from "@server/test/support";
import teamProvisioner from "./teamProvisioner";
setupTestDatabase();
@@ -10,9 +13,7 @@ describe("teamProvisioner", () => {
const ip = "127.0.0.1";
describe("hosted", () => {
beforeEach(() => {
env.DEPLOYMENT = "hosted";
});
beforeEach(setCloudHosted);
it("should create team and authentication provider", async () => {
const result = await teamProvisioner({
@@ -127,9 +128,7 @@ describe("teamProvisioner", () => {
});
describe("self hosted", () => {
beforeEach(() => {
env.DEPLOYMENT = undefined;
});
beforeEach(setSelfHosted);
it("should allow creating first team", async () => {
const { team, isNewTeam } = await teamProvisioner({

View File

@@ -78,7 +78,7 @@ async function teamProvisioner({
};
} else if (teamId) {
// The user is attempting to log into a team with an unfamiliar SSO provider
if (env.isCloudHosted()) {
if (env.isCloudHosted) {
throw InvalidAuthenticationError();
}

View File

@@ -34,7 +34,7 @@ const teamUpdater = async ({
preferences,
} = params;
if (subdomain !== undefined && env.SUBDOMAINS_ENABLED) {
if (subdomain !== undefined && env.isCloudHosted) {
team.subdomain = subdomain === "" ? null : subdomain;
}