Skip to content

Commit f59b606

Browse files
committed
add env var support for discovering kubeconfig path
1 parent 97bde28 commit f59b606

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

KubeConnect/Args.cs

+5-1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ public class Args
3939

4040
public Args(string[] args)
4141
{
42+
// read env vars for default values
43+
this.KubeconfigFile = Environment.GetEnvironmentVariable("KUBECONFIG");
44+
this.Context = Environment.GetEnvironmentVariable("KUBECONTEXT");
45+
4246
this.RemainingArgs = Array.Empty<string>();
4347
Func<string, string, string, bool> processArg = (option, arg, argNext) =>
4448
{
@@ -190,7 +194,7 @@ private void ProcessArgs(string[] args, Func<string, string, string, bool> proce
190194

191195
}
192196
}
193-
197+
194198
public int MainPort { get; set; } = 10401;
195199
public bool EnableTraceLogs { get; set; } = false;
196200
public string? Namespace { get; set; }

0 commit comments

Comments
 (0)