rename core-module environment to twenty-config (#11445)
closes https://github.com/twentyhq/core-team-issues/issues/759
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
|
||||
import { DomainManagerService } from 'src/engine/core-modules/domain-manager/services/domain-manager.service';
|
||||
import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service';
|
||||
import { TwentyConfigService } from 'src/engine/core-modules/twenty-config/twenty-config.service';
|
||||
|
||||
import { ClientConfigResolver } from './client-config.resolver';
|
||||
|
||||
@ -13,7 +13,7 @@ describe('ClientConfigResolver', () => {
|
||||
providers: [
|
||||
ClientConfigResolver,
|
||||
{
|
||||
provide: EnvironmentService,
|
||||
provide: TwentyConfigService,
|
||||
useValue: {},
|
||||
},
|
||||
{
|
||||
|
||||
@ -1,17 +1,17 @@
|
||||
import { Query, Resolver } from '@nestjs/graphql';
|
||||
|
||||
import { NodeEnvironment } from 'src/engine/core-modules/environment/interfaces/node-environment.interface';
|
||||
import { NodeEnvironment } from 'src/engine/core-modules/twenty-config/interfaces/node-environment.interface';
|
||||
|
||||
import { DomainManagerService } from 'src/engine/core-modules/domain-manager/services/domain-manager.service';
|
||||
import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service';
|
||||
import { PUBLIC_FEATURE_FLAGS } from 'src/engine/core-modules/feature-flag/constants/public-feature-flag.const';
|
||||
import { TwentyConfigService } from 'src/engine/core-modules/twenty-config/twenty-config.service';
|
||||
|
||||
import { ClientConfig } from './client-config.entity';
|
||||
|
||||
@Resolver()
|
||||
export class ClientConfigResolver {
|
||||
constructor(
|
||||
private environmentService: EnvironmentService,
|
||||
private twentyConfigService: TwentyConfigService,
|
||||
private domainManagerService: DomainManagerService,
|
||||
) {}
|
||||
|
||||
@ -19,17 +19,17 @@ export class ClientConfigResolver {
|
||||
async clientConfig(): Promise<ClientConfig> {
|
||||
const clientConfig: ClientConfig = {
|
||||
billing: {
|
||||
isBillingEnabled: this.environmentService.get('IS_BILLING_ENABLED'),
|
||||
billingUrl: this.environmentService.get('BILLING_PLAN_REQUIRED_LINK'),
|
||||
isBillingEnabled: this.twentyConfigService.get('IS_BILLING_ENABLED'),
|
||||
billingUrl: this.twentyConfigService.get('BILLING_PLAN_REQUIRED_LINK'),
|
||||
trialPeriods: [
|
||||
{
|
||||
duration: this.environmentService.get(
|
||||
duration: this.twentyConfigService.get(
|
||||
'BILLING_FREE_TRIAL_WITH_CREDIT_CARD_DURATION_IN_DAYS',
|
||||
),
|
||||
isCreditCardRequired: true,
|
||||
},
|
||||
{
|
||||
duration: this.environmentService.get(
|
||||
duration: this.twentyConfigService.get(
|
||||
'BILLING_FREE_TRIAL_WITHOUT_CREDIT_CARD_DURATION_IN_DAYS',
|
||||
),
|
||||
isCreditCardRequired: false,
|
||||
@ -37,63 +37,64 @@ export class ClientConfigResolver {
|
||||
],
|
||||
},
|
||||
authProviders: {
|
||||
google: this.environmentService.get('AUTH_GOOGLE_ENABLED'),
|
||||
google: this.twentyConfigService.get('AUTH_GOOGLE_ENABLED'),
|
||||
magicLink: false,
|
||||
password: this.environmentService.get('AUTH_PASSWORD_ENABLED'),
|
||||
microsoft: this.environmentService.get('AUTH_MICROSOFT_ENABLED'),
|
||||
password: this.twentyConfigService.get('AUTH_PASSWORD_ENABLED'),
|
||||
microsoft: this.twentyConfigService.get('AUTH_MICROSOFT_ENABLED'),
|
||||
sso: [],
|
||||
},
|
||||
signInPrefilled: this.environmentService.get('SIGN_IN_PREFILLED'),
|
||||
isMultiWorkspaceEnabled: this.environmentService.get(
|
||||
signInPrefilled: this.twentyConfigService.get('SIGN_IN_PREFILLED'),
|
||||
isMultiWorkspaceEnabled: this.twentyConfigService.get(
|
||||
'IS_MULTIWORKSPACE_ENABLED',
|
||||
),
|
||||
isEmailVerificationRequired: this.environmentService.get(
|
||||
isEmailVerificationRequired: this.twentyConfigService.get(
|
||||
'IS_EMAIL_VERIFICATION_REQUIRED',
|
||||
),
|
||||
defaultSubdomain: this.environmentService.get('DEFAULT_SUBDOMAIN'),
|
||||
defaultSubdomain: this.twentyConfigService.get('DEFAULT_SUBDOMAIN'),
|
||||
frontDomain: this.domainManagerService.getFrontUrl().hostname,
|
||||
debugMode:
|
||||
this.environmentService.get('NODE_ENV') === NodeEnvironment.development,
|
||||
this.twentyConfigService.get('NODE_ENV') ===
|
||||
NodeEnvironment.development,
|
||||
support: {
|
||||
supportDriver: this.environmentService.get('SUPPORT_DRIVER'),
|
||||
supportFrontChatId: this.environmentService.get(
|
||||
supportDriver: this.twentyConfigService.get('SUPPORT_DRIVER'),
|
||||
supportFrontChatId: this.twentyConfigService.get(
|
||||
'SUPPORT_FRONT_CHAT_ID',
|
||||
),
|
||||
},
|
||||
sentry: {
|
||||
environment: this.environmentService.get('SENTRY_ENVIRONMENT'),
|
||||
release: this.environmentService.get('SENTRY_RELEASE'),
|
||||
dsn: this.environmentService.get('SENTRY_FRONT_DSN'),
|
||||
environment: this.twentyConfigService.get('SENTRY_ENVIRONMENT'),
|
||||
release: this.twentyConfigService.get('SENTRY_RELEASE'),
|
||||
dsn: this.twentyConfigService.get('SENTRY_FRONT_DSN'),
|
||||
},
|
||||
captcha: {
|
||||
provider: this.environmentService.get('CAPTCHA_DRIVER'),
|
||||
siteKey: this.environmentService.get('CAPTCHA_SITE_KEY'),
|
||||
provider: this.twentyConfigService.get('CAPTCHA_DRIVER'),
|
||||
siteKey: this.twentyConfigService.get('CAPTCHA_SITE_KEY'),
|
||||
},
|
||||
chromeExtensionId: this.environmentService.get('CHROME_EXTENSION_ID'),
|
||||
chromeExtensionId: this.twentyConfigService.get('CHROME_EXTENSION_ID'),
|
||||
api: {
|
||||
mutationMaximumAffectedRecords: this.environmentService.get(
|
||||
mutationMaximumAffectedRecords: this.twentyConfigService.get(
|
||||
'MUTATION_MAXIMUM_AFFECTED_RECORDS',
|
||||
),
|
||||
},
|
||||
isAttachmentPreviewEnabled: this.environmentService.get(
|
||||
isAttachmentPreviewEnabled: this.twentyConfigService.get(
|
||||
'IS_ATTACHMENT_PREVIEW_ENABLED',
|
||||
),
|
||||
analyticsEnabled: this.environmentService.get('ANALYTICS_ENABLED'),
|
||||
analyticsEnabled: this.twentyConfigService.get('ANALYTICS_ENABLED'),
|
||||
canManageFeatureFlags:
|
||||
this.environmentService.get('NODE_ENV') ===
|
||||
this.twentyConfigService.get('NODE_ENV') ===
|
||||
NodeEnvironment.development ||
|
||||
this.environmentService.get('IS_BILLING_ENABLED'),
|
||||
this.twentyConfigService.get('IS_BILLING_ENABLED'),
|
||||
publicFeatureFlags: PUBLIC_FEATURE_FLAGS,
|
||||
isMicrosoftMessagingEnabled: this.environmentService.get(
|
||||
isMicrosoftMessagingEnabled: this.twentyConfigService.get(
|
||||
'MESSAGING_PROVIDER_MICROSOFT_ENABLED',
|
||||
),
|
||||
isMicrosoftCalendarEnabled: this.environmentService.get(
|
||||
isMicrosoftCalendarEnabled: this.twentyConfigService.get(
|
||||
'CALENDAR_PROVIDER_MICROSOFT_ENABLED',
|
||||
),
|
||||
isGoogleMessagingEnabled: this.environmentService.get(
|
||||
isGoogleMessagingEnabled: this.twentyConfigService.get(
|
||||
'MESSAGING_PROVIDER_GMAIL_ENABLED',
|
||||
),
|
||||
isGoogleCalendarEnabled: this.environmentService.get(
|
||||
isGoogleCalendarEnabled: this.twentyConfigService.get(
|
||||
'CALENDAR_PROVIDER_GOOGLE_ENABLED',
|
||||
),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user