@@ -93,7 +93,7 @@ export async function askQuestions(setup: Setup): Promise<void> {
93
93
shouldProvisionCSQL : false ,
94
94
} ;
95
95
// Query backend and pick up any existing services quickly.
96
- info = await promptForExistingServices ( setup , info , hasBilling ) ;
96
+ info = await promptForExistingServices ( setup , info ) ;
97
97
98
98
const requiredConfigUnset =
99
99
info . serviceId === "" ||
@@ -110,6 +110,7 @@ export async function askQuestions(setup: Setup): Promise<void> {
110
110
default : true ,
111
111
} ) ) ;
112
112
if ( shouldConfigureBackend ) {
113
+ // TODO: Prompt for app idea and use GiF backend to generate them.
113
114
info = await promptForService ( info ) ;
114
115
info = await promptForCloudSQL ( setup , info ) ;
115
116
@@ -122,14 +123,6 @@ export async function askQuestions(setup: Setup): Promise<void> {
122
123
default : true ,
123
124
} ) )
124
125
) ;
125
- } else {
126
- // Ensure that the suggested name is DNS compatible
127
- const defaultServiceId = toDNSCompatibleId ( basename ( process . cwd ( ) ) ) ;
128
- info . serviceId = info . serviceId || defaultServiceId ;
129
- info . cloudSqlInstanceId =
130
- info . cloudSqlInstanceId || `${ info . serviceId . toLowerCase ( ) || "app" } -fdc` ;
131
- info . locationId = info . locationId || `us-central1` ;
132
- info . cloudSqlDatabase = info . cloudSqlDatabase || `fdcdb` ;
133
126
}
134
127
setup . featureInfo = setup . featureInfo || { } ;
135
128
setup . featureInfo . dataconnect = info ;
@@ -147,6 +140,14 @@ export async function actuate(setup: Setup, config: Config): Promise<void> {
147
140
if ( ! info ) {
148
141
throw new Error ( "Data Connect feature RequiredInfo is not provided" ) ;
149
142
}
143
+ // Populate the default values of required fields.
144
+ const defaultServiceId = toDNSCompatibleId ( basename ( process . cwd ( ) ) ) ;
145
+ info . serviceId = info . serviceId || defaultServiceId ;
146
+ info . cloudSqlInstanceId =
147
+ info . cloudSqlInstanceId || `${ info . serviceId . toLowerCase ( ) || "app" } -fdc` ;
148
+ info . locationId = info . locationId || `us-central1` ;
149
+ info . cloudSqlDatabase = info . cloudSqlDatabase || `fdcdb` ;
150
+
150
151
await writeFiles ( config , info ) ;
151
152
152
153
if ( setup . projectId && info . shouldProvisionCSQL ) {
@@ -266,24 +267,15 @@ function subConnectorYamlValues(replacementValues: { connectorId: string }): str
266
267
return replaced ;
267
268
}
268
269
269
- async function promptForExistingServices (
270
- setup : Setup ,
271
- info : RequiredInfo ,
272
- isBillingEnabled : boolean ,
273
- ) : Promise < RequiredInfo > {
274
- if ( ! setup . projectId || ! isBillingEnabled ) {
275
- // TODO(b/368609569): Don't gate this behind billing once backend billing fix is rolled out.
270
+ async function promptForExistingServices ( setup : Setup , info : RequiredInfo ) : Promise < RequiredInfo > {
271
+ // Check for existing Firebase Data Connect services.
272
+ if ( ! setup . projectId ) {
276
273
return info ;
277
274
}
278
-
279
- // Check for existing Firebase Data Connect services.
280
275
const existingServices = await listAllServices ( setup . projectId ) ;
281
276
const existingServicesAndSchemas = await Promise . all (
282
277
existingServices . map ( async ( s ) => {
283
- return {
284
- service : s ,
285
- schema : await getSchema ( s . name ) ,
286
- } ;
278
+ return { service : s , schema : await getSchema ( s . name ) } ;
287
279
} ) ,
288
280
) ;
289
281
if ( existingServicesAndSchemas . length ) {
0 commit comments