chore: Centralize environment detection

This commit is contained in:
Tom Moor
2023-11-09 09:13:50 -05:00
parent 096a65b0f9
commit a1b52e18dd
9 changed files with 37 additions and 31 deletions

View File

@@ -711,6 +711,27 @@ export class Environment {
].includes(this.URL);
}
/**
* Returns true if the current installation is running in production.
*/
public get isProduction() {
return this.ENVIRONMENT === "production";
}
/**
* Returns true if the current installation is running in the development environment.
*/
public get isDevelopment() {
return this.ENVIRONMENT === "development";
}
/**
* Returns true if the current installation is running in a test environment.
*/
public get isTest() {
return this.ENVIRONMENT === "test";
}
private toOptionalString(value: string | undefined) {
return value ? value : undefined;
}