-
Notifications
You must be signed in to change notification settings - Fork 174
Expand file tree
/
Copy pathdevmode.go
More file actions
36 lines (28 loc) · 1.12 KB
/
devmode.go
File metadata and controls
36 lines (28 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package devmode
import (
"path/filepath"
"runtime"
"github.com/stackrox/rox/pkg/buildinfo"
"github.com/stackrox/rox/pkg/debughandler"
"github.com/stackrox/rox/pkg/devbuild"
"github.com/stackrox/rox/pkg/env"
)
const binaryRoot = "/stackrox"
// StartOnDevBuilds start the development mode only if a dev build is enabled.
// Enables a binary watchdog to restart the container if the underlying binary changed.
func StartOnDevBuilds(binaryPath string) {
if !devbuild.IsEnabled() || buildinfo.ReleaseBuild {
return
}
if env.HotReload.BooleanSetting() {
log.Warn("")
log.Warn("***********************************************************************************")
log.Warn("This binary is being hot reloaded. It may be a different version from the image tag")
log.Warn("***********************************************************************************")
log.Warn("***********************************************************************************")
go startBinaryWatchdog(filepath.Join(binaryRoot, binaryPath))
}
debughandler.MustStartServerAsync("")
runtime.SetBlockProfileRate(1)
runtime.SetMutexProfileFraction(1)
}