misc: adds option to enable pprof
This commit is contained in:
parent
285d7eb4aa
commit
fb702b40f5
3 changed files with 16 additions and 1 deletions
|
@ -20,4 +20,5 @@ HTTPS_PROXY=
|
||||||
NO_PROXY=
|
NO_PROXY=
|
||||||
|
|
||||||
# misc
|
# misc
|
||||||
REPO_URL=https://github.com/govdbot/govd
|
REPO_URL=https://github.com/govdbot/govd
|
||||||
|
PROFILER_PORT=0
|
|
@ -32,6 +32,7 @@ sh build.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
## installation with docker
|
## installation with docker
|
||||||
|
|
||||||
first build the image using the dockerfile
|
first build the image using the dockerfile
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
@ -71,6 +72,7 @@ docker compose up -d
|
||||||
| `HTTPS_PROXY` | http proxy (optional) | |
|
| `HTTPS_PROXY` | http proxy (optional) | |
|
||||||
| `NO_PROXY` | no proxy domains (optional) | |
|
| `NO_PROXY` | no proxy domains (optional) | |
|
||||||
| `REPO_URL` | project repository url | `https://github.com/govdbot/govd` |
|
| `REPO_URL` | project repository url | `https://github.com/govdbot/govd` |
|
||||||
|
| `PROFILER_PORT` | port for profiler http server (pprof) | `0` _(disabled)_ |
|
||||||
|
|
||||||
**note:**
|
**note:**
|
||||||
to avoid limits on files, you should host your own telegram botapi. public bot instance is currently running under a botapi fork, [tdlight-telegram-bot-api](https://github.com/tdlight-team/tdlight-telegram-bot-api), but you can use the official botapi client too.
|
to avoid limits on files, you should host your own telegram botapi. public bot instance is currently running under a botapi fork, [tdlight-telegram-bot-api](https://github.com/tdlight-team/tdlight-telegram-bot-api), but you can use the official botapi client too.
|
||||||
|
|
12
main.go
12
main.go
|
@ -1,10 +1,16 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"govd/bot"
|
"govd/bot"
|
||||||
"govd/database"
|
"govd/database"
|
||||||
"govd/util"
|
"govd/util"
|
||||||
"log"
|
"log"
|
||||||
|
"net/http"
|
||||||
|
"os"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
_ "net/http/pprof"
|
||||||
|
|
||||||
"github.com/joho/godotenv"
|
"github.com/joho/godotenv"
|
||||||
)
|
)
|
||||||
|
@ -14,6 +20,12 @@ func main() {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal("error loading .env file")
|
log.Fatal("error loading .env file")
|
||||||
}
|
}
|
||||||
|
profilerPort, err := strconv.Atoi(os.Getenv("PROFILER_PORT"))
|
||||||
|
if err == nil && profilerPort > 0 {
|
||||||
|
go func() {
|
||||||
|
http.ListenAndServe(fmt.Sprintf("localhost:%d", profilerPort), nil)
|
||||||
|
}()
|
||||||
|
}
|
||||||
util.CleanupDownloadsDir()
|
util.CleanupDownloadsDir()
|
||||||
util.StartDownloadsCleanup()
|
util.StartDownloadsCleanup()
|
||||||
ok := util.CheckFFmpeg()
|
ok := util.CheckFFmpeg()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue