Skip to content

Commit a9b80ca

Browse files
authored
Merge pull request #120 from Roasbeef/profile-port-fix
config: fix profile port arg parsing
2 parents 8088b61 + c715f72 commit a9b80ca

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

aperture.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,8 @@ func (a *Aperture) Start(errChan chan error) error {
201201
}
202202

203203
// Enable http profiling and validate profile port number if requested.
204-
if a.cfg.ProfilePort != 0 {
205-
if a.cfg.ProfilePort < 1024 || a.cfg.ProfilePort > 65535 {
204+
if a.cfg.Profile != 0 {
205+
if a.cfg.Profile < 1024 || a.cfg.Profile > 65535 {
206206
return fmt.Errorf("the profile port must be between " +
207207
"1024 and 65535")
208208
}
@@ -212,9 +212,7 @@ func (a *Aperture) Start(errChan chan error) error {
212212
"/debug/pprof", http.StatusSeeOther,
213213
))
214214

215-
listenAddr := fmt.Sprintf(
216-
"localhost:%d", a.cfg.ProfilePort,
217-
)
215+
listenAddr := fmt.Sprintf("localhost:%d", a.cfg.Profile)
218216

219217
log.Infof("Starting profile server at %s", listenAddr)
220218
fmt.Println(http.ListenAndServe(listenAddr, nil))

config.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,8 @@ type Config struct {
200200
// BaseDir is a custom directory to store all aperture flies.
201201
BaseDir string `long:"basedir" description:"Directory to place all of aperture's files in."`
202202

203-
// ProfilePort is the port on which the pprof profile will be served.
204-
ProfilePort uint16 `long:"profile" description:"Enable HTTP profiling on given port -- NOTE port must be between 1024 and 65535"`
203+
// Profile is the port on which the pprof profile will be served.
204+
Profile uint16 `long:"profile" description:"Enable HTTP profiling on given port -- NOTE port must be between 1024 and 65535"`
205205
}
206206

207207
func (c *Config) validate() error {

0 commit comments

Comments
 (0)