mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
Read server options from publish profile (#21960)
* Read encrypt and trust server certificate * Set hostname in certificate setting * Address comment- open connection dialog if the connection string in publish profile doesn't load a connection, instead of throwing an error.
This commit is contained in:
@@ -546,6 +546,9 @@ export const authenticationSetting = 'Authentication';
|
|||||||
export const activeDirectoryInteractive = 'active directory interactive';
|
export const activeDirectoryInteractive = 'active directory interactive';
|
||||||
export const userIdSetting = 'User ID';
|
export const userIdSetting = 'User ID';
|
||||||
export const passwordSetting = 'Password';
|
export const passwordSetting = 'Password';
|
||||||
|
export const encryptSetting = 'Encrypt';
|
||||||
|
export const trustServerCertificateSetting = 'Trust Server Certificate';
|
||||||
|
export const hostnameInCertificateSetting = 'Host Name in Certificate';
|
||||||
|
|
||||||
export const azureAddAccount = localize('azureAddAccount', "Add an Account...");
|
export const azureAddAccount = localize('azureAddAccount', "Add an Account...");
|
||||||
|
|
||||||
|
|||||||
@@ -62,6 +62,18 @@ export class SqlConnectionDataSource extends DataSource {
|
|||||||
return this.getSetting(constants.passwordSetting);
|
return this.getSetting(constants.passwordSetting);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public get encrypt(): string {
|
||||||
|
return this.getSetting(constants.encryptSetting);
|
||||||
|
}
|
||||||
|
|
||||||
|
public get trustServerCertificate(): string {
|
||||||
|
return this.getSetting(constants.trustServerCertificateSetting);
|
||||||
|
}
|
||||||
|
|
||||||
|
public get hostnameInCertificate(): string {
|
||||||
|
return this.getSetting(constants.hostnameInCertificateSetting);
|
||||||
|
}
|
||||||
|
|
||||||
constructor(name: string, connectionString: string) {
|
constructor(name: string, connectionString: string) {
|
||||||
super(name);
|
super(name);
|
||||||
|
|
||||||
@@ -100,7 +112,11 @@ export class SqlConnectionDataSource extends DataSource {
|
|||||||
providerName: 'MSSQL',
|
providerName: 'MSSQL',
|
||||||
saveProfile: true,
|
saveProfile: true,
|
||||||
id: this.name + '-dataSource',
|
id: this.name + '-dataSource',
|
||||||
options: []
|
options: {
|
||||||
|
'encrypt': this.encrypt,
|
||||||
|
'trustServerCertificate': this.trustServerCertificate,
|
||||||
|
'hostnameInCertificate': this.hostnameInCertificate
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return connProfile;
|
return connProfile;
|
||||||
|
|||||||
@@ -89,8 +89,12 @@ async function readConnectionString(xmlDoc: any): Promise<{ connectionId: string
|
|||||||
if (dataSource.integratedSecurity) {
|
if (dataSource.integratedSecurity) {
|
||||||
if (azdataApi) {
|
if (azdataApi) {
|
||||||
const connectionResult = await utils.getAzdataApi()!.connection.connect(connectionProfile, false, false);
|
const connectionResult = await utils.getAzdataApi()!.connection.connect(connectionProfile, false, false);
|
||||||
utils.throwIfNotConnected(connectionResult);
|
if (!connectionResult.connected) {
|
||||||
connId = connectionResult.connectionId!;
|
const connection = await utils.getAzdataApi()!.connection.openConnectionDialog(undefined, connectionProfile);
|
||||||
|
connId = connection.connectionId;
|
||||||
|
} else {
|
||||||
|
connId = connectionResult.connectionId!;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// TODO@chgagnon - hook up VS Code MSSQL
|
// TODO@chgagnon - hook up VS Code MSSQL
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user