From 96dd481b02baa0d7dadef3f5ac66ebfaaa4fbd7b Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Tue, 31 May 2022 16:13:52 +0800 Subject: [PATCH 1/4] fix: error:0909006C:PEM routines:get_name:no start line --- packages/nocodb/src/plugins/gcs/Gcs.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/nocodb/src/plugins/gcs/Gcs.ts b/packages/nocodb/src/plugins/gcs/Gcs.ts index 7eb2d039a4..bb3788b93c 100644 --- a/packages/nocodb/src/plugins/gcs/Gcs.ts +++ b/packages/nocodb/src/plugins/gcs/Gcs.ts @@ -67,7 +67,9 @@ export default class Gcs implements IStorageAdapter { // this.bucketName = process.env.NC_GCS_BUCKET; options.credentials = { client_email: this.input.client_email, - private_key: this.input.private_key + // replace \n with real line breaks to avoid + // error:0909006C:PEM routines:get_name:no start line + private_key: this.input.private_key.replace(/\\n/gm, '\n') }; this.bucketName = this.input.bucket; From a1b2d0ac25a828d94606b5a42e7ef737eca93627 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Tue, 31 May 2022 19:32:24 +0800 Subject: [PATCH 2/4] feat: include project id --- packages/nocodb/src/plugins/gcs/Gcs.ts | 5 +++++ packages/nocodb/src/plugins/gcs/index.ts | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/packages/nocodb/src/plugins/gcs/Gcs.ts b/packages/nocodb/src/plugins/gcs/Gcs.ts index bb3788b93c..ca51b0286e 100644 --- a/packages/nocodb/src/plugins/gcs/Gcs.ts +++ b/packages/nocodb/src/plugins/gcs/Gcs.ts @@ -72,6 +72,11 @@ export default class Gcs implements IStorageAdapter { private_key: this.input.private_key.replace(/\\n/gm, '\n') }; + // default project ID would be used if it is not provided + if (this.input.project_id) { + options.projectId = this.input.project_id + } + this.bucketName = this.input.bucket; this.storageClient = new Storage(options); diff --git a/packages/nocodb/src/plugins/gcs/index.ts b/packages/nocodb/src/plugins/gcs/index.ts index 71984150ea..cd50b46c44 100644 --- a/packages/nocodb/src/plugins/gcs/index.ts +++ b/packages/nocodb/src/plugins/gcs/index.ts @@ -36,6 +36,13 @@ const config: XcPluginConfig = { placeholder: 'Private Key', type: XcType.Password, required: true + }, + { + key: 'project_id', + label: 'Project ID', + placeholder: 'Project ID', + type: XcType.SingleLineText, + required: false } ], actions: [ From d14c37558abcb4e996408b1706cd0e3b95596617 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Wed, 1 Jun 2022 17:56:17 +0800 Subject: [PATCH 3/4] chore: bump GCS plugin version --- packages/nocodb/src/plugins/gcs/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/nocodb/src/plugins/gcs/index.ts b/packages/nocodb/src/plugins/gcs/index.ts index cd50b46c44..4b9ec5e26e 100644 --- a/packages/nocodb/src/plugins/gcs/index.ts +++ b/packages/nocodb/src/plugins/gcs/index.ts @@ -6,7 +6,7 @@ import GcsPlugin from './GcsPlugin'; const config: XcPluginConfig = { builder: GcsPlugin, title: 'GCS', - version: '0.0.1', + version: '0.0.2', logo: 'plugins/gcs.png', description: 'Google Cloud Storage is a RESTful online file storage web service for storing and accessing data on Google Cloud Platform infrastructure.', From 089f2b57c7d3170af2ba82f56b3f23028d4e1f76 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Wed, 1 Jun 2022 17:56:29 +0800 Subject: [PATCH 4/4] feat: add update logic if version not matched --- .../nocodb/src/lib/noco/meta/helpers/NcPluginMgrv2.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/nocodb/src/lib/noco/meta/helpers/NcPluginMgrv2.ts b/packages/nocodb/src/lib/noco/meta/helpers/NcPluginMgrv2.ts index 0d8ec41526..2541ac3425 100644 --- a/packages/nocodb/src/lib/noco/meta/helpers/NcPluginMgrv2.ts +++ b/packages/nocodb/src/lib/noco/meta/helpers/NcPluginMgrv2.ts @@ -80,6 +80,14 @@ class NcPluginMgrv2 { category: plugin.category, input_schema: JSON.stringify(plugin.inputs) }); + } else if (pluginConfig.version !== plugin.version) { + await ncMeta.metaUpdate( + null, + null, + MetaTable.PLUGIN, + plugin, + pluginConfig.id + ); } /* init only the active plugins */