Skip to content

Commit 0fb6578

Browse files
authored
Add header command to the download CLI and login phases (#323)
1 parent 31c3824 commit 0fb6578

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/main/kotlin/com/coder/gateway/sdk/CoderCLIManager.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,12 @@ class CoderCLIManager @JvmOverloads constructor(
101101
fun downloadCLI(): Boolean {
102102
val etag = getBinaryETag()
103103
val conn = remoteBinaryURL.openConnection() as HttpURLConnection
104+
if (settings.headerCommand.isNotBlank()) {
105+
val headersFromHeaderCommand = CoderRestClient.getHeaders(deploymentURL, settings.headerCommand)
106+
for ((key, value) in headersFromHeaderCommand) {
107+
conn.setRequestProperty(key, value)
108+
}
109+
}
104110
if (etag != null) {
105111
logger.info("Found existing binary at $localBinaryPath; calculated hash as $etag")
106112
conn.setRequestProperty("If-None-Match", "\"$etag\"")
@@ -364,6 +370,7 @@ class CoderCLIManager @JvmOverloads constructor(
364370
private fun exec(vararg args: String): String {
365371
val stdout = ProcessExecutor()
366372
.command(localBinaryPath.toString(), *args)
373+
.environment("CODER_HEADER_COMMAND", settings.headerCommand)
367374
.exitValues(0)
368375
.readOutput(true)
369376
.execute()

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy