Added option to enable pprof.

This commit is contained in:
claudemiro
2016-09-01 21:03:29 -03:00
parent 0bd4fa02e9
commit 9d732fb01a
5 changed files with 10 additions and 2 deletions
+2 -1
View File
@@ -50,7 +50,8 @@ $ go install github.com/dimiro1/ipe
```javascript
{
"Host": ":8080", // Required
"SSL": false, // Required but can be false
"SSL": false, // Not Required, default is false
"Profiling": false, // Mount pprof at /debug. Not Required, default is false
"SSLHost": ":4433", // Required if SSL is true
"SSLKeyFile": "A key.pem file", // Required if SSL is true
"SSLCertFile": "A cert.pem file", // Required if SSL is true
+2 -1
View File
@@ -1,6 +1,7 @@
{
"Host": ":8080",
"Encrypted": false,
"SSL": false,
"Profiling": true,
"SSLHost": ":8090",
"SSLKeyFile": "key.pem",
"SSLCertFile": "cert.pem",
+1
View File
@@ -1,6 +1,7 @@
{
"Host": ":8080",
"SSL": false,
"Profiling": false,
"SSLHost": ":4433",
"SSLKeyFile": "A key.pem file",
"SSLCertFile": "A cert.pem file",
+1
View File
@@ -9,6 +9,7 @@ type configFile struct {
Host string // The host, eg: :8080 will start on 0.0.0.0:8080
User string
SSL bool
Profiling bool
SSLHost string
SSLKeyFile string
SSLCertFile string
+4
View File
@@ -59,6 +59,10 @@ func Start(filename string) {
r.Get("/apps/:app_id/channels/:channel_name/users", (&getChannelUsersHandler{db}).ServeHTTP)
})
if conf.Profiling {
r.Mount("/debug", middleware.Profiler())
}
if conf.SSL {
go func() {
log.Infof("Starting HTTPS service on %s ...", conf.SSLHost)