mirror of
https://github.com/caddyserver/xcaddy.git
synced 2024-11-03 07:50:30 +00:00
Disable timeouts by default, make configurable (fix #15)
This commit is contained in:
parent
446eab4eb6
commit
1eaff742db
2 changed files with 9 additions and 5 deletions
|
@ -38,6 +38,8 @@ type Builder struct {
|
||||||
CaddyVersion string `json:"caddy_version,omitempty"`
|
CaddyVersion string `json:"caddy_version,omitempty"`
|
||||||
Plugins []Dependency `json:"plugins,omitempty"`
|
Plugins []Dependency `json:"plugins,omitempty"`
|
||||||
Replacements []Replace `json:"replacements,omitempty"`
|
Replacements []Replace `json:"replacements,omitempty"`
|
||||||
|
TimeoutGet time.Duration `json:"timeout_get,omitempty"`
|
||||||
|
TimeoutBuild time.Duration `json:"timeout_build,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build builds Caddy at the configured version with the
|
// Build builds Caddy at the configured version with the
|
||||||
|
@ -91,7 +93,7 @@ func (b Builder) Build(ctx context.Context, outputFile string) error {
|
||||||
"-trimpath",
|
"-trimpath",
|
||||||
)
|
)
|
||||||
cmd.Env = env
|
cmd.Env = env
|
||||||
err = buildEnv.runCommand(ctx, cmd, 5*time.Minute)
|
err = buildEnv.runCommand(ctx, cmd, b.TimeoutBuild)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,6 +94,7 @@ func (b Builder) newEnvironment(ctx context.Context) (*environment, error) {
|
||||||
plugins: b.Plugins,
|
plugins: b.Plugins,
|
||||||
caddyModulePath: caddyModulePath,
|
caddyModulePath: caddyModulePath,
|
||||||
tempFolder: tempFolder,
|
tempFolder: tempFolder,
|
||||||
|
timeoutGoGet: b.TimeoutGet,
|
||||||
}
|
}
|
||||||
|
|
||||||
// initialize the go module
|
// initialize the go module
|
||||||
|
@ -157,6 +158,7 @@ type environment struct {
|
||||||
plugins []Dependency
|
plugins []Dependency
|
||||||
caddyModulePath string
|
caddyModulePath string
|
||||||
tempFolder string
|
tempFolder string
|
||||||
|
timeoutGoGet time.Duration
|
||||||
}
|
}
|
||||||
|
|
||||||
// Close cleans up the build environment, including deleting
|
// Close cleans up the build environment, including deleting
|
||||||
|
@ -226,7 +228,7 @@ func (env environment) execGoGet(ctx context.Context, modulePath, moduleVersion
|
||||||
mod += "@" + moduleVersion
|
mod += "@" + moduleVersion
|
||||||
}
|
}
|
||||||
cmd := env.newCommand("go", "get", "-d", "-v", mod)
|
cmd := env.newCommand("go", "get", "-d", "-v", mod)
|
||||||
return env.runCommand(ctx, cmd, 5*time.Minute)
|
return env.runCommand(ctx, cmd, env.timeoutGoGet)
|
||||||
}
|
}
|
||||||
|
|
||||||
type goModTemplateContext struct {
|
type goModTemplateContext struct {
|
||||||
|
|
Loading…
Reference in a new issue