Skip to content

Commit 261f522

Browse files
committed
Env var renaming
1 parent 4162845 commit 261f522

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,11 +270,11 @@ func main() {
270270
log.Info("Not running telemetry component!")
271271
}
272272

273-
pprofEnabledString := env.ReadOrDefault(util.PprofEnabledEnv, "")
273+
pprofEnabledString := env.ReadOrDefault(util.OperatorPprofEnabledEnv, "")
274274
if pprofEnabled, err := pprof.IsPprofEnabled(pprofEnabledString, getOperatorEnv()); err != nil {
275275
log.Errorf("Unable to check if pprof is enabled: %s", err)
276276
} else if pprofEnabled {
277-
port := env.ReadIntOrDefault(util.PprofPortEnv, util.PprofDefaultPort)
277+
port := env.ReadIntOrDefault(util.OperatorPprofPortEnv, util.OperatorPprofDefaultPort)
278278
if err := mgr.Add(pprof.NewRunnable(port, log)); err != nil {
279279
log.Errorf("Unable to start pprof server: %s", err)
280280
}

pkg/pprof/pprof.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,16 +63,16 @@ func (p *Runnable) Start(ctx context.Context) error {
6363
return nil
6464
}
6565

66-
// IsPprofEnabled checks if pprof is enabled based on the PPROF_ENABLED
66+
// IsPprofEnabled checks if pprof is enabled based on the MDB_OPERATOR_PPROF_ENABLED
6767
// and OPERATOR_ENV environment variables. It returns true if:
68-
// - PPROF_ENABLED is set to true
69-
// - OPERATOR_ENV is set to dev or local and PPROF_ENABLED is not set
68+
// - MDB_OPERATOR_PPROF_ENABLED is set to true
69+
// - OPERATOR_ENV is set to dev or local and MDB_OPERATOR_PPROF_ENABLED is not set
7070
// Otherwise, it returns false.
7171
func IsPprofEnabled(pprofEnabledString string, operatorEnv util.OperatorEnvironment) (bool, error) {
7272
if pprofEnabledString != "" {
7373
pprofEnabled, err := strconv.ParseBool(pprofEnabledString)
7474
if err != nil {
75-
return false, fmt.Errorf("unable to parse %s environment variable: %w", util.PprofEnabledEnv, err)
75+
return false, fmt.Errorf("unable to parse %s environment variable: %w", util.OperatorPprofEnabledEnv, err)
7676
}
7777

7878
return pprofEnabled, nil

pkg/util/constants.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,9 @@ const (
152152
MinimumScramSha256MdbVersion = "4.0.0"
153153

154154
// pprof variables
155-
PprofEnabledEnv = "PPROF_ENABLED"
156-
PprofPortEnv = "PPROF_PORT"
157-
PprofDefaultPort = 10081
155+
OperatorPprofEnabledEnv = "MDB_OPERATOR_PPROF_ENABLED"
156+
OperatorPprofPortEnv = "MDB_OPERATOR_PPROF_PORT"
157+
OperatorPprofDefaultPort = 10081
158158

159159
// these were historically used and constituted a security issue—if set they should be changed
160160
InvalidKeyFileContents = "DUMMYFILE"

0 commit comments

Comments
 (0)