|
83 | 83 | Timeout time.Duration |
84 | 84 | CacheExpiryDuration time.Duration |
85 | 85 | RemoteCacheDir string |
| 86 | + CACert string |
| 87 | + Cert string |
| 88 | + CertKey string |
86 | 89 | Interactive bool |
87 | 90 | ) |
88 | 91 |
|
@@ -168,6 +171,9 @@ func init() { |
168 | 171 | pflag.BoolVar(&ClearCache, "clear-cache", false, "Clear the remote cache.") |
169 | 172 | pflag.DurationVar(&CacheExpiryDuration, "expiry", getConfig(config, func() *time.Duration { return config.Remote.CacheExpiry }, 0), "Expiry duration for cached remote Taskfiles.") |
170 | 173 | pflag.StringVar(&RemoteCacheDir, "remote-cache-dir", getConfig(config, func() *string { return config.Remote.CacheDir }, env.GetTaskEnv("REMOTE_DIR")), "Directory to cache remote Taskfiles.") |
| 174 | + pflag.StringVar(&CACert, "cacert", getConfig(config, func() *string { return config.Remote.CACert }, ""), "Path to a custom CA certificate for HTTPS connections.") |
| 175 | + pflag.StringVar(&Cert, "cert", getConfig(config, func() *string { return config.Remote.Cert }, ""), "Path to a client certificate for HTTPS connections.") |
| 176 | + pflag.StringVar(&CertKey, "cert-key", getConfig(config, func() *string { return config.Remote.CertKey }, ""), "Path to a client certificate key for HTTPS connections.") |
171 | 177 | } |
172 | 178 | pflag.Parse() |
173 | 179 |
|
@@ -236,6 +242,11 @@ func Validate() error { |
236 | 242 | return errors.New("task: --nested only applies to --json with --list or --list-all") |
237 | 243 | } |
238 | 244 |
|
| 245 | + // Validate certificate flags |
| 246 | + if (Cert != "" && CertKey == "") || (Cert == "" && CertKey != "") { |
| 247 | + return errors.New("task: --cert and --cert-key must be provided together") |
| 248 | + } |
| 249 | + |
239 | 250 | return nil |
240 | 251 | } |
241 | 252 |
|
@@ -278,6 +289,9 @@ func (o *flagsOption) ApplyToExecutor(e *task.Executor) { |
278 | 289 | task.WithTimeout(Timeout), |
279 | 290 | task.WithCacheExpiryDuration(CacheExpiryDuration), |
280 | 291 | task.WithRemoteCacheDir(RemoteCacheDir), |
| 292 | + task.WithCACert(CACert), |
| 293 | + task.WithCert(Cert), |
| 294 | + task.WithCertKey(CertKey), |
281 | 295 | task.WithWatch(Watch), |
282 | 296 | task.WithVerbose(Verbose), |
283 | 297 | task.WithSilent(Silent), |
|
0 commit comments