Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,19 @@ BUSAPI_URL="http://localhost:4000/eventBus"
MAX_PHASE_PRODUCT_COUNT=100
UNIQUE_GMAIL_VALIDATION=false

ENABLE_FILE_UPLOAD=true
FILE_SERVICE_ENDPOINT="http://localhost:4000/file"
ATTACHMENTS_S3_BUCKET="topcoder-prod-media"
PROJECT_ATTACHMENT_PATH_PREFIX="projects"
PROJECT_ATTACHMENT_PATH_SUFFIX="attachments"

AWS_S3_ENDPOINT="http://localhost:4566"
AWS_S3_REGION="us-east-1"
AWS_S3_API_VERSION="2006-03-01"
AWS_ACCESS_KEY_ID="test"
AWS_SECRET_ACCESS_KEY="test"
AWS_S3_FORCE_PATH_STYLE=true

IDENTITY_SERVICE_ENDPOINT="http://localhost:4000/identity"
MEMBER_SERVICE_ENDPOINT="https://api.topcoder-dev.com/v5/members"
COPILOT_PORTAL_URL="https://copilots.topcoder-dev.com"
Expand All @@ -35,3 +48,10 @@ INVITE_EMAIL_SUBJECT="You are invited to Topcoder"
INVITE_EMAIL_SECTION_TITLE="Project Invitation"
SSO_REFCODES="[]"

SALESFORCE_CLIENT_AUDIENCE="http://localhost:4000/salesforce"
SALESFORCE_CLIENT_KEY="your-private-key"
SALESFORCE_CLIENT_ID="abcd"
SALESFORCE_SUBJECT="subject"
SFDC_BILLING_ACCOUNT_NAME_FIELD="Billing_Account_name__c"
SFDC_BILLING_ACCOUNT_MARKUP_FIELD="Mark_Up__c"
SFDC_BILLING_ACCOUNT_ACTIVE_FIELD="Active__c"
28 changes: 28 additions & 0 deletions config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,23 @@ export const AppConfig = {
maxPhaseProductCount: process.env.MAX_PHASE_PRODUCT_COUNT || 100,
uniqueGmailValidation: process.env.UNIQUE_GMAIL_VALIDATION === 'true' || false,
prismaTransactionTimeout: process.env.PRISMA_TRANSACTION_TIMEOUT ? parseInt(process.env.PRISMA_TRANSACTION_TIMEOUT ) : 60000, // Sets the timeout to 60 seconds
enableFileUpload: process.env.ENABLE_FILE_UPLOAD === 'true' || false,

authSecret: process.env.AUTH_SECRET || 'secret',
validIssuers: process.env.VALID_ISSUERS
? process.env.VALID_ISSUERS.replace(/\\"/g, '')
: '["https://api.topcoder-dev.com", "https://api.topcoder.com","https://topcoder-dev.auth0.com/"]',
identityServiceEndpoint: process.env.IDENTITY_SERVICE_ENDPOINT || 'http://localhost:4000/identity',
fileServiceEndpoint: process.env.FILE_SERVICE_ENDPOINT || 'http://localhost:4000/file',
memberServiceEndpoint: process.env.MEMBER_SERVICE_ENDPOINT || 'https://api.topcoder-dev.com/v5/members',
copilotPortalUrl: process.env.COPILOT_PORTAL_URL || 'https://copilots.topcoder-dev.com',
workManagerUrl: process.env.WORK_MANAGER_URL || 'https://challenges.topcoder-dev.com',
accountsAppUrl: process.env.ACCOUNTS_APP_URL || 'https://accounts.topcoder-dev.com',
inviteEmailSubject: process.env.INVITE_EMAIL_SUBJECT || 'You are invited to Topcoder',
inviteEmailSectionTitle: process.env.INVITE_EMAIL_SECTION_TITLE || 'Project Invitation',
attachmentsS3Bucket: process.env.ATTACHMENTS_S3_BUCKET || 'topcoder-prod-media',
projectAttachmentPathPrefix: process.env.PROJECT_ATTACHMENT_PATH_PREFIX || 'projects',
projectAttachmentPathSuffix: process.env.PROJECT_ATTACHMENT_PATH_SUFFIX || 'attachments',
SSO_REFCODES: process.env.SSO_REFCODES || '[]',
}

Expand Down Expand Up @@ -47,3 +52,26 @@ export const EventBusConfig = {
kafkaErrorTopic: process.env.KAFKA_ERROR_TOPIC ?? 'common.error.reporting',
}

export function AwsS3Config() {
return {
endpoint: process.env.AWS_S3_ENDPOINT || 'http://localhost:4566',
region: process.env.AWS_S3_REGION || 'us-east-1',
apiVersion: process.env.AWS_S3_API_VERSION || '2006-03-01',
accessKeyId: process.env.AWS_ACCESS_KEY_ID || 'test',
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY || 'test',
s3ForcePathStyle: process.env.AWS_S3_FORCE_PATH_STYLE === 'true' || true, // Crucial for LocalStack S3
}
}

export function SalesforceConfig() {
return {
clientAudience: process.env.SALESFORCE_CLIENT_AUDIENCE || 'https://login.salesforce.com',
clientKey: process.env.SALESFORCE_CLIENT_KEY || 'privateKey',
clientId: process.env.SALESFORCE_CLIENT_ID || '',
subject: process.env.SALESFORCE_SUBJECT || '',
sfdcBillingAccountNameField: process.env.SFDC_BILLING_ACCOUNT_NAME_FIELD || 'Billing_Account_name__c',
sfdcBillingAccountMarkupField: process.env.SFDC_BILLING_ACCOUNT_MARKUP_FIELD || 'Mark_Up__c',
sfdcBillingAccountActiveField: process.env.SFDC_BILLING_ACCOUNT_ACTIVE_FIELD || 'Active__c',
}
}

Loading