allow users to select firestore databases other than the default

This commit is contained in:
andz-bb 2024-12-19 16:24:55 +00:00
parent 59a98ec0cb
commit 2d7ef6cee4
1 changed files with 11 additions and 0 deletions

View File

@ -12,6 +12,7 @@ interface FirebaseConfig {
email: string
privateKey: string
projectId: string
databaseId?: string
}
const SCHEMA: Integration = {
@ -30,12 +31,21 @@ const SCHEMA: Integration = {
},
privateKey: {
type: DatasourceFieldType.STRING,
display: "Private Key",
required: true,
},
projectId: {
type: DatasourceFieldType.STRING,
display: "Project ID",
required: true,
},
databaseId: {
type: DatasourceFieldType.STRING,
display: "Database ID",
required: false,
default: "(default)",
placeholder: "(default)",
},
},
query: {
create: {
@ -97,6 +107,7 @@ class FirebaseIntegration implements IntegrationBase {
this.config = config
this.client = new Firestore({
projectId: config.projectId,
databaseId: config.databaseId || "(default)",
credentials: {
client_email: config.email,
private_key: config.privateKey?.replace(/\\n/g, "\n"),