Skip to content

Commit ac10af8

Browse files
committed
Get config once
A tiny refactor since I will need to get a third config option.
1 parent 8beb761 commit ac10af8

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

src/storage.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -123,13 +123,11 @@ export class Storage {
123123
* downloads being disabled.
124124
*/
125125
public async fetchBinary(restClient: Api, label: string): Promise<string> {
126-
const baseUrl = restClient.getAxiosInstance().defaults.baseURL;
126+
const cfg = vscode.workspace.getConfiguration("coder");
127127

128128
// Settings can be undefined when set to their defaults (true in this case),
129129
// so explicitly check against false.
130-
const enableDownloads =
131-
vscode.workspace.getConfiguration().get("coder.enableDownloads") !==
132-
false;
130+
const enableDownloads = cfg.get("enableDownloads") !== false;
133131
this.output.info("Downloads are", enableDownloads ? "enabled" : "disabled");
134132

135133
// Get the build info to compare with the existing binary version, if any,
@@ -189,9 +187,7 @@ export class Storage {
189187

190188
// Figure out where to get the binary.
191189
const binName = cli.name();
192-
const configSource = vscode.workspace
193-
.getConfiguration()
194-
.get("coder.binarySource");
190+
const configSource = cfg.get("binarySource");
195191
const binSource =
196192
configSource && String(configSource).trim().length > 0
197193
? String(configSource)

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