Skip to content

Commit e6c7f1e

Browse files
yu-shibaYuichiro SHIBAYAMA
authored andcommitted
Changed to set USERPROFILE on Windows environment.
1 parent 68d9116 commit e6c7f1e

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

util/src/main/java/io/kubernetes/client/util/KubeConfig.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public class KubeConfig {
3434
private static final Logger log = LoggerFactory.getLogger(KubeConfig.class);
3535

3636
// Defaults for where to find a kubeconfig file
37-
public static final String ENV_HOME = "HOME";
37+
public static final String ENV_HOME;
3838
public static final String KUBEDIR = ".kube";
3939
public static final String KUBECONFIG = "config";
4040
private static Map<String, Authenticator> authenticators = new HashMap<>();
@@ -63,6 +63,12 @@ public static void registerAuthenticator(Authenticator auth) {
6363
static {
6464
registerAuthenticator(new GCPAuthenticator());
6565
registerAuthenticator(new AzureActiveDirectoryAuthenticator());
66+
67+
if (System.getProperty("os.name").toLowerCase().startsWith("windows")) {
68+
ENV_HOME = "USERPROFILE";
69+
} else {
70+
ENV_HOME = "HOME";
71+
}
6672
}
6773

6874
/** Load a Kubernetes config from a Reader */

0 commit comments

Comments
 (0)