Skip to content

Commit

Permalink
Add asia-southeast1 to RTDB CLI (#3460)
Browse files Browse the repository at this point in the history
  • Loading branch information
fredzqm authored Jun 8, 2021
1 parent e19e01a commit 696cf80
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
- Add Warsaw (europe-central2) Cloud Function Location to Firebase Extension template.
- Add Singapore (asia-southeast1) as a valid Firebase Realtime Database location.
1 change: 1 addition & 0 deletions src/init/features/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ async function createDefaultDatabaseInstance(project: string): Promise<DatabaseI
choices: [
{ name: "us-central1", value: DatabaseLocation.US_CENTRAL1 },
{ name: "europe-west1", value: DatabaseLocation.EUROPE_WEST1 },
{ name: "asia-southeast1", value: DatabaseLocation.ASIA_SOUTHEAST1 },
],
});
let instanceName = `${project}-default-rtdb`;
Expand Down
9 changes: 6 additions & 3 deletions src/management/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export enum DatabaseInstanceState {
export enum DatabaseLocation {
US_CENTRAL1 = "us-central1",
EUROPE_WEST1 = "europe-west1",
ASIA_SOUTHEAST1 = "asia-southeast1",
ANY = "-",
}

Expand Down Expand Up @@ -206,15 +207,17 @@ export function parseDatabaseLocation(
return defaultLocation;
}
switch (location.toLowerCase()) {
case "europe-west1":
return DatabaseLocation.EUROPE_WEST1;
case "us-central1":
return DatabaseLocation.US_CENTRAL1;
case "europe-west1":
return DatabaseLocation.EUROPE_WEST1;
case "asia-southeast1":
return DatabaseLocation.ASIA_SOUTHEAST1;
case "":
return defaultLocation;
default:
throw new FirebaseError(
`Unexpected location value: ${location}. Only us-central1, and europe-west1 locations are supported`
`Unexpected location value: ${location}. Only us-central1, europe-west1, and asia-southeast1 locations are supported`
);
}
}
Expand Down

0 comments on commit 696cf80

Please sign in to comment.