Moved MongoDb connection string override into credentials (#1)

* interim work on credentials refactor

* move conn string override for mongodb into credentials and enhance credentials typings
This commit is contained in:
Chris Lonardo
2020-04-06 21:07:54 -04:00
committed by GitHub
parent 00fc6e5980
commit d80deda34f
5 changed files with 149 additions and 68 deletions

View File

@@ -1,8 +1,4 @@
import {
ICredentialType,
NodePropertyTypes,
} from 'n8n-workflow';
import { ICredentialType, NodePropertyTypes } from 'n8n-workflow';
export class MongoDb implements ICredentialType {
name = 'mongoDb';
@@ -12,34 +8,57 @@ export class MongoDb implements ICredentialType {
displayName: 'Host',
name: 'host',
type: 'string' as NodePropertyTypes,
default: 'localhost',
default: 'localhost'
},
{
displayName: 'Database',
name: 'database',
type: 'string' as NodePropertyTypes,
default: '',
description:
'Note: the database should still be provided even if using an override connection string'
},
{
displayName: 'User',
name: 'user',
type: 'string' as NodePropertyTypes,
default: '',
default: ''
},
{
displayName: 'Password',
name: 'password',
type: 'string' as NodePropertyTypes,
typeOptions: {
password: true,
password: true
},
default: '',
default: ''
},
{
displayName: 'Port',
name: 'port',
type: 'number' as NodePropertyTypes,
default: 27017,
default: 27017
},
{
displayName: 'Override conn string',
name: 'shouldOverrideConnString',
type: 'boolean' as NodePropertyTypes,
default: false,
required: false,
description:
'Whether to override the generated connection string. Credentials will also be ignored in this case.'
},
{
displayName: 'Conn string override',
name: 'connStringOverrideVal',
type: 'string' as NodePropertyTypes,
typeOptions: {
rows: 1
},
default: '',
placeholder: `mongodb://USERNAMEHERE:PASSWORDHERE@localhost:27017/?authSource=admin&readPreference=primary&appname=n8n&ssl=false`,
required: false,
description: `If provided, the value here will be used as a MongoDB connection string, and the MongoDB credentials will be ignored`
}
];
}