@@ -16,14 +16,6 @@ import { Construct } from "constructs";
1616import * as atlas from "../../index" ;
1717import { AtlasServerlessBasicProps } from "../common/props" ;
1818
19- /** @type {* } */
20- const projectDefaults = {
21- projectName : "atlas-project-" ,
22- } ;
23- /** @type {* } */
24- const serverlessDefaults = {
25- serverlessName : "atlas-serverless-" ,
26- } ;
2719/** @type {* } */
2820const dbDefaults = {
2921 dbName : "admin" ,
@@ -81,9 +73,7 @@ export class AtlasServerlessBasic extends Construct {
8173 //Create a new MongoDB Atlas Project
8274 this . mProject = new atlas . CfnProject ( this , "project-" . concat ( id ) , {
8375 profile : props . profile ,
84- name :
85- props . projectProps . name ||
86- projectDefaults . projectName . concat ( String ( randomNumber ( ) ) ) ,
76+ name : props . projectProps . name ?? `project-${ id } ` ,
8777 ...props . projectProps ,
8878 } ) ;
8979 // Create a new serverless Instance and pass project ID
@@ -92,18 +82,10 @@ export class AtlasServerlessBasic extends Construct {
9282 "serverless-" . concat ( id ) ,
9383 {
9484 projectId : this . mProject . attrId ,
95- name :
96- props . serverlessProps . name ||
97- serverlessDefaults . serverlessName . concat ( String ( randomNumber ( ) ) ) ,
98- providerSettings : {
99- providerName :
100- atlas . ServerlessInstanceProviderSettingsProviderName . SERVERLESS ,
101- regionName : "us-east-1" ,
102- } ,
85+ name : props . serverlessProps . name ?? `serverless-${ id } ` ,
86+ providerSettings : props . serverlessProps . providerSettings ,
10387 profile : props . profile ,
104- continuousBackupEnabled : this . node . tryGetContext (
105- "continuousBackupEnabled"
106- ) ,
88+ continuousBackupEnabled : props . serverlessProps . continuousBackupEnabled ,
10789 ...props . serverlessProps ,
10890 }
10991 ) ;
@@ -133,9 +115,3 @@ export class AtlasServerlessBasic extends Construct {
133115 this . ipAccessList . addDependency ( this . mProject ) ;
134116 }
135117}
136-
137- function randomNumber ( ) {
138- const min = 10 ;
139- const max = 9999999 ;
140- return Math . floor ( Math . random ( ) * ( max - min + 1 ) + min ) ;
141- }
0 commit comments