Skip to content

Commit 7e7fab5

Browse files
committed
Env var renaming
1 parent 77994a5 commit 7e7fab5

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
@@ -278,11 +278,11 @@ func main() {
278278
log.Info("Not running telemetry component!")
279279
}
280280

281-
pprofEnabledString := env.ReadOrDefault(util.PprofEnabledEnv, "")
281+
pprofEnabledString := env.ReadOrDefault(util.OperatorPprofEnabledEnv, "")
282282
if pprofEnabled, err := pprof.IsPprofEnabled(pprofEnabledString, getOperatorEnv()); err != nil {
283283
log.Errorf("Unable to check if pprof is enabled: %s", err)
284284
} else if pprofEnabled {
285-
port := env.ReadIntOrDefault(util.PprofPortEnv, util.PprofDefaultPort)
285+
port := env.ReadIntOrDefault(util.OperatorPprofPortEnv, util.OperatorPprofDefaultPort)
286286
if err := mgr.Add(pprof.NewRunnable(port, log)); err != nil {
287287
log.Errorf("Unable to start pprof server: %s", err)
288288
}

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
@@ -155,9 +155,9 @@ const (
155155
MinimumScramSha256MdbVersion = "4.0.0"
156156

157157
// pprof variables
158-
PprofEnabledEnv = "PPROF_ENABLED"
159-
PprofPortEnv = "PPROF_PORT"
160-
PprofDefaultPort = 10081
158+
OperatorPprofEnabledEnv = "MDB_OPERATOR_PPROF_ENABLED"
159+
OperatorPprofPortEnv = "MDB_OPERATOR_PPROF_PORT"
160+
OperatorPprofDefaultPort = 10081
161161

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

0 commit comments

Comments
 (0)