Skip to content
This repository has been archived by the owner on Mar 21, 2023. It is now read-only.

Commit

Permalink
Add mirror env variable when set by the user
Browse files Browse the repository at this point in the history
  • Loading branch information
tgodzik committed Feb 24, 2022
1 parent 04112b5 commit 1c7e69e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/getJavaConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export interface JavaConfig {
javaOptions: string[];
javaPath: string;
coursierPath: string;
coursierMirrorFilePath: string | undefined;
extraEnv: {
[k: string]: string | undefined;
};
Expand All @@ -14,27 +15,31 @@ interface GetJavaConfigOptions {
workspaceRoot: string | undefined;
javaHome: string;
extensionPath: string;
coursierMirrorFilePath: string | undefined;
customRepositories: string[] | undefined;
}

export function getJavaConfig({
workspaceRoot,
javaHome,
extensionPath,
coursierMirrorFilePath,
customRepositories = [],
}: GetJavaConfigOptions): JavaConfig {
const javaOptions = getJavaOptions(workspaceRoot);
const javaPath = path.join(javaHome, "bin", "java");
const coursierPath = path.join(extensionPath, "./coursier");
const extraEnv = {
COURSIER_REPOSITORIES: customRepositories.join("|"),
COURSIER_MIRRORS: coursierMirrorFilePath,
JAVA_HOME: javaHome,
};

return {
javaOptions,
javaPath,
coursierPath,
coursierMirrorFilePath,
extraEnv,
};
}

0 comments on commit 1c7e69e

Please sign in to comment.