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

@@ -70,9 +70,9 @@ class Team extends ParanoidModel {
@Unique
@Length({
min: 2,
max: env.isCloudHosted() ? 32 : 255,
max: env.isCloudHosted ? 32 : 255,
msg: `subdomain must be between 2 and ${
env.isCloudHosted() ? 32 : 255
env.isCloudHosted ? 32 : 255
} characters`,
})
@Is({
@@ -169,7 +169,7 @@ class Team extends ParanoidModel {
return `${url.protocol}//${this.domain}${url.port ? `:${url.port}` : ""}`;
}
if (!this.subdomain || !env.SUBDOMAINS_ENABLED) {
if (!this.subdomain || !env.isCloudHosted) {
return env.URL;
}

View File

@@ -1,11 +1,12 @@
import env from "@server/env";
import { buildAdmin, buildTeam } from "@server/test/factories";
import { setupTestDatabase } from "@server/test/support";
import { setCloudHosted, setupTestDatabase } from "@server/test/support";
import TeamDomain from "./TeamDomain";
setupTestDatabase();
describe("team domain model", () => {
beforeEach(setCloudHosted);
describe("create", () => {
it("should allow creation of domains", async () => {
const team = await buildTeam();
@@ -37,7 +38,6 @@ describe("team domain model", () => {
});
it("should not allow creation of domains within restricted list", async () => {
env.DEPLOYMENT = "hosted";
const TeamDomain = await import("./TeamDomain");
const team = await buildTeam();
const user = await buildAdmin({ teamId: team.id });
@@ -57,7 +57,6 @@ describe("team domain model", () => {
});
it("should ignore casing and spaces when creating domains", async () => {
env.DEPLOYMENT = "hosted";
const TeamDomain = await import("./TeamDomain");
const team = await buildTeam();
const user = await buildAdmin({ teamId: team.id });

View File

@@ -23,7 +23,7 @@ import Length from "./validators/Length";
@Fix
class TeamDomain extends IdModel {
@NotIn({
args: env.isCloudHosted() ? [emailProviders] : [],
args: env.isCloudHosted ? [emailProviders] : [],
msg: "You chose a restricted domain, please try another.",
})
@NotEmpty

View File

@@ -74,7 +74,7 @@ export default class AuthenticationHelper {
* @returns A list of authentication providers
*/
public static providersForTeam(team?: Team) {
const isCloudHosted = env.isCloudHosted();
const isCloudHosted = env.isCloudHosted;
return AuthenticationHelper.providers
.sort((config) => (config.id === "email" ? 1 : -1))