const SupportedRegions = {
North: 'eu-north-1'
}
const SupportedEnvironments = {
LOCAL: 'local',
QA: 'qa',
TEST: 'test',
DEMO: 'demo',
PROD: 'prod'
}
const SupportedDeploymentTypes = {
Container: 'CONTAINER'
// Static = 'STATIC'
}
// export interface PlatformConfig extends Required<Omit<PlatformTemplate, 'awsRoleToAssume' | 'awsKeyPairName'>> {
// activeEnvironment: SupportedEnvironments;
// awsRoleToAssume?: string;
// awsKeyPairName?: string;
// }
/**
* @class
*/
class PlatformConfigService {
static from(template) {
const withDefaults = {
platformName: SupportedEnvironments.LOCAL,
domain: 'localhost',
activeEnvironment: SupportedEnvironments.LOCAL,
supportedDeploymentTypes: ['CONTAINER'],
ciSubDomain: 'ci',
ciInternalServerPort: 3000,
ciServerName: 'ci-client',
ciDockerNetworkName: 'deployment-tools',
awsRegion: SupportedRegions.North,
...template
}
const awsDeploymentSqsArn = `https://sqs.${withDefaults.awsRegion}.amazonaws.com/${withDefaults.awsAccountId}/${withDefaults.platformName}-${withDefaults.activeEnvironment}`
const awsRoleToAssume = process.env.CI ? 'github-ci-role' : undefined
return {
...withDefaults,
awsDeploymentSqsArn,
awsRoleToAssume
}
}
}
module.exports = {
PlatformConfigService,
SupportedRegions,
SupportedEnvironments,
SupportedDeploymentTypes
}