diff --git a/packages/driver.pg/connection.schema.json b/packages/driver.pg/connection.schema.json index cfcdb9c99..88429c2ca 100644 --- a/packages/driver.pg/connection.schema.json +++ b/packages/driver.pg/connection.schema.json @@ -19,7 +19,8 @@ "SQLTools Driver Credentials", "Ask on connect", "Use empty password", - "Save as plaintext in settings" + "Save as plaintext in settings", + "Retrieve from environ" ], "default": "SQLTools Driver Credentials" }, @@ -27,6 +28,11 @@ "title": "Password", "type": "string", "minLength": 1 + }, + "environ": { + "title": "Environ variable name", + "type": "string", + "minLength": 1 } }, "properties": { @@ -122,12 +128,6 @@ ] } } - }, - "ssh": { - "title": "Over SSH", - "type": "string", - "enum": ["Enabled", "Disabled"], - "default": "Disabled" } }, "dependencies": { @@ -259,63 +259,30 @@ "properties": { "usePassword": { "enum": [ - "SQLTools Driver Credentials" + "Retrieve from environ" ] + }, + "environ": { + "$ref": "#/definitions/environ" } - } - } - ] - }, - "ssh": { - "oneOf": [ - { - "properties": { - "ssh": { - "enum": ["Disabled"] - } - } + }, + "required": [ + "environ" + ] }, { "properties": { - "ssh": { - "enum": ["Enabled"] - }, - "sshOptions": { - "type": "object", - "title": "SSH Connection Options", - "properties": { - "host": { - "type": "string", - "title": "Server Address", - "minLength": 1 - }, - "port": { - "type": "integer", - "title": "Port", - "default": 22, - "minimum": 1 - }, - "username": { - "type": "string", - "title": "Username", - "minLength": 1 - }, - "password": { - "type": "string", - "title": "Password" - }, - "privateKeyPath": { - "type": "string", - "title": "Private Key File Path" - } - }, - "required": ["host", "username"] + "usePassword": { + "enum": [ + "SQLTools Driver Credentials" + ] } - }, - "required": ["sshOptions"] + } } ] } }, - "required": ["connectionMethod"] + "required": [ + "connectionMethod" + ] } diff --git a/packages/driver.pg/src/extension.ts b/packages/driver.pg/src/extension.ts index d6aff95ea..a4eed5feb 100644 --- a/packages/driver.pg/src/extension.ts +++ b/packages/driver.pg/src/extension.ts @@ -1,6 +1,7 @@ import { IExtension, IExtensionPlugin, IDriverExtensionApi } from '@sqltools/types'; import { ExtensionContext, extensions, authentication } from 'vscode'; import { DRIVER_ALIASES } from './constants'; +import { Connection } from 'pg'; const { publisher, name } = require('../package.json'); const driverName = 'PostgreSQL/Cockroach'; const AUTHENTICATION_PROVIDER = 'sqltools-driver-credentials'; @@ -54,14 +55,21 @@ export async function activate(extContext: ExtensionContext): Promise