mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-25 19:31:05 +00:00
Skip settings proxy config with WithProxy if its empty (#2242)
close #2208
This commit is contained in:
parent
a5ef372190
commit
55e98a186a
1 changed files with 9 additions and 0 deletions
|
@ -25,6 +25,10 @@ import (
|
|||
// Option configures a compiler option.
|
||||
type Option func(*Compiler)
|
||||
|
||||
func noopOption() Option {
|
||||
return func(*Compiler) {}
|
||||
}
|
||||
|
||||
// WithOption configures the compiler with the given option if
|
||||
// boolean b evaluates to true.
|
||||
func WithOption(option Option, b bool) Option {
|
||||
|
@ -226,6 +230,11 @@ type ProxyOptions struct {
|
|||
// and NO_PROXY environment variables added by default to every
|
||||
// container in the pipeline.
|
||||
func WithProxy(opt ProxyOptions) Option {
|
||||
if opt.HTTPProxy == "" &&
|
||||
opt.HTTPSProxy == "" &&
|
||||
opt.NoProxy == "" {
|
||||
return noopOption()
|
||||
}
|
||||
return WithEnviron(
|
||||
map[string]string{
|
||||
"no_proxy": opt.NoProxy,
|
||||
|
|
Loading…
Reference in a new issue