@profoundlogic/coderflow-cli 0.10.21 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/terminal-client.js +5 -2
- package/package.json +1 -1
package/lib/terminal-client.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { WebSocket } from 'ws';
|
|
7
|
-
import { getServerUrl } from './config.js';
|
|
7
|
+
import { getServerUrl, getApiKey } from './config.js';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Connect to server's WebSocket terminal and provide interactive session
|
|
@@ -23,8 +23,11 @@ export async function connectTerminal(containerId, cmd = null) {
|
|
|
23
23
|
wsUrl.searchParams.set('cmd', cmd);
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
const apiKey = await getApiKey();
|
|
27
|
+
const wsOptions = apiKey ? { headers: { Authorization: `Bearer ${apiKey}` } } : {};
|
|
28
|
+
|
|
26
29
|
return new Promise((resolve, reject) => {
|
|
27
|
-
const ws = new WebSocket(wsUrl.toString());
|
|
30
|
+
const ws = new WebSocket(wsUrl.toString(), wsOptions);
|
|
28
31
|
let connected = false;
|
|
29
32
|
|
|
30
33
|
ws.on('open', () => {
|