Skip to content

Fetch keychain-stored password when objectscript.conn.server is specified #227

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,19 @@ We recommend you define server connections in the `intersystems.servers` object
"host": "127.0.0.1",
"port": 52773
},
"description": "My local IRIS",
"username": "me"
"description": "My local IRIS",
"username": "me"
}
}
```
Setting the `username` property is optional. If omitted it will be prompted for when connecting.

By defining connections in your User Settings they become available for use by any workspace you open in VSCode.
By defining connections in your User Settings they become available for use by any workspace you open in VSCode. Alternatively, define them in workspace-specific settings.

Setting the `username` property is optional. If omitted it will be prompted for when connecting, then cached for the session..

Setting a plaintext value for the `password` property is not recommended. Instead, run the `InterSystems Server Manager: Store Password in Keychain` command from Command Palette.

If no password has been set or stored it will be prompted for when connecting, then cached for the session.

### Client-side Editing

Expand All @@ -66,7 +71,9 @@ We recommend that `objectscript.conn` uses its `server` property to point to an
}
```

The mandatory `ns` property defines which server namespace you will work with. If `username` is set here it overrides that setting from the `intersystems.servers` entry.
The mandatory `ns` property defines which server namespace you will work with.

When the `server` property is set, any `username` or `password` properties of `objectscript.conn` are ignored. Instead these values come from the `intersystems.servers` entry.

### Server-side Editing

Expand Down
9 changes: 6 additions & 3 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -388,9 +388,12 @@ export async function activate(context: vscode.ExtensionContext): Promise<void>
});
toCheck.forEach(async function (uri, configName) {
if (serverManagerApi && serverManagerApi.getServerSpec) {
const connSpec = await serverManagerApi.getServerSpec(configName);
if (connSpec) {
resolvedConnSpecs.set(configName, connSpec);
const serverName = uri.scheme === "file" ? config("conn", configName).server : configName;
if (serverName && serverName !== "" && !resolvedConnSpecs.has(serverName)) {
const connSpec = await serverManagerApi.getServerSpec(serverName);
if (connSpec) {
resolvedConnSpecs.set(serverName, connSpec);
}
}
}
checkConnection(true, uri);
Expand Down