mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
cmd/geth: add --noenv to disable the use of environment variables
Signed-off-by: jsvisa <delweng@gmail.com>
This commit is contained in:
parent
37a2d919b0
commit
f16de081d3
2 changed files with 24 additions and 2 deletions
|
|
@ -242,8 +242,22 @@ func init() {
|
|||
consoleFlags,
|
||||
debug.Flags,
|
||||
metricsFlags,
|
||||
[]cli.Flag{utils.NoEnvironmentFlag},
|
||||
)
|
||||
flags.AutoEnvVars(app.Flags, "GETH")
|
||||
|
||||
noenv := false
|
||||
for _, arg := range os.Args {
|
||||
flag := strings.TrimLeft(arg, "-")
|
||||
if flag == utils.NoEnvironmentFlag.Name {
|
||||
log.Info("Disables the use of environment variables for configuration")
|
||||
noenv = true
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if !noenv {
|
||||
flags.AutoEnvVars(app.Flags, "GETH")
|
||||
}
|
||||
|
||||
app.Before = func(ctx *cli.Context) error {
|
||||
maxprocs.Set() // Automatically set GOMAXPROCS to match Linux container CPU quota.
|
||||
|
|
@ -251,7 +265,9 @@ func init() {
|
|||
if err := debug.Setup(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
flags.CheckEnvVars(ctx, app.Flags, "GETH")
|
||||
if !noenv {
|
||||
flags.CheckEnvVars(ctx, app.Flags, "GETH")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
app.After = func(ctx *cli.Context) error {
|
||||
|
|
|
|||
|
|
@ -949,6 +949,12 @@ Please note that --` + MetricsHTTPFlag.Name + ` must be set to start the server.
|
|||
Value: metrics.DefaultConfig.InfluxDBOrganization,
|
||||
Category: flags.MetricsCategory,
|
||||
}
|
||||
|
||||
NoEnvironmentFlag = &cli.BoolFlag{
|
||||
Name: "noenv",
|
||||
Usage: "Disables the use of environment variables for configuration",
|
||||
Category: flags.MiscCategory,
|
||||
}
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
|
|||
Loading…
Reference in a new issue