Browse Source

Merge pull request #2216 from nocodb/fix/gcs-plugin

fix: GCS plugin
pull/2217/head
աɨռɢӄաօռɢ 2 years ago committed by GitHub
parent
commit
434c8e1a2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      packages/nocodb/src/lib/noco/meta/helpers/NcPluginMgrv2.ts
  2. 9
      packages/nocodb/src/plugins/gcs/Gcs.ts
  3. 9
      packages/nocodb/src/plugins/gcs/index.ts

8
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 */

9
packages/nocodb/src/plugins/gcs/Gcs.ts

@ -68,9 +68,16 @@ export default class Gcs implements IStorageAdapterV2 {
// 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')
};
// 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);

9
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.',
@ -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: [

Loading…
Cancel
Save