@@ -8,25 +8,15 @@ import { printBackendsTable } from "./apphosting-backends-list";
8
8
9
9
export const command = new Command ( "apphosting:backends:get <backend>" )
10
10
. description ( "print info about a Firebase App Hosting backend" )
11
- . option ( "-l, --location <location>" , "backend location" )
12
11
. before ( apphosting . ensureApiEnabled )
13
12
. action ( async ( backend : string , options : Options ) => {
14
13
const projectId = needProjectId ( options ) ;
15
- if ( options . location !== undefined ) {
16
- logWarning ( "--location is being removed in the next major release." ) ;
17
- }
18
- const location = ( options . location as string ) ?? "-" ;
19
14
20
15
let backendsList : apphosting . Backend [ ] = [ ] ;
21
16
try {
22
- if ( location !== "-" ) {
23
- const backendInRegion = await apphosting . getBackend ( projectId , location , backend ) ;
24
- backendsList . push ( backendInRegion ) ;
25
- } else {
26
- const resp = await apphosting . listBackends ( projectId , "-" ) ;
27
- const allBackends = resp . backends || [ ] ;
28
- backendsList = allBackends . filter ( ( bkd ) => bkd . name . split ( "/" ) . pop ( ) === backend ) ;
29
- }
17
+ const resp = await apphosting . listBackends ( projectId , "-" ) ;
18
+ const allBackends = resp . backends || [ ] ;
19
+ backendsList = allBackends . filter ( ( bkd ) => bkd . name . split ( "/" ) . pop ( ) === backend ) ;
30
20
} catch ( err : unknown ) {
31
21
throw new FirebaseError (
32
22
`Failed to get backend: ${ backend } . Please check the parameters you have provided.` ,
@@ -37,6 +27,13 @@ export const command = new Command("apphosting:backends:get <backend>")
37
27
logWarning ( `Backend "${ backend } " not found` ) ;
38
28
return ;
39
29
}
40
- printBackendsTable ( backendsList ) ;
30
+ if ( backendsList . length > 1 ) {
31
+ logWarning (
32
+ `Detected multiple backends with the same ${ backend } ID. This is not allowed until we can support more locations.\n` +
33
+ `Please delete and recreate any backends that share an ID with another backend. ` +
34
+ `Use apphosting:backends:list to see all backends.\n Returning the following backend:` ,
35
+ ) ;
36
+ }
37
+ printBackendsTable ( backendsList . slice ( 0 , 1 ) ) ;
41
38
return backendsList [ 0 ] ;
42
39
} ) ;
0 commit comments