mirror of
https://github.com/tgdrive/teldrive.git
synced 2024-09-20 08:15:55 +08:00
feat: change name and location of bot session file
This commit is contained in:
parent
fe19a77b6e
commit
1b0a2625ce
|
@ -32,7 +32,7 @@ services:
|
|||
restart: always
|
||||
container_name: teldrive
|
||||
volumes:
|
||||
- ./teldrive.db:/teldrive.db:rw
|
||||
- ./session.db:/session.db:rw
|
||||
- ./config.toml:/config.toml
|
||||
ports:
|
||||
- 8080:8080
|
||||
|
@ -48,7 +48,7 @@ services:
|
|||
restart: always
|
||||
container_name: teldrive
|
||||
volumes:
|
||||
- ./teldrive.db:/teldrive.db:rw
|
||||
- ./session.db:/session.db:rw
|
||||
- ./config.toml:/config.toml
|
||||
ports:
|
||||
- 8080:8080
|
||||
|
@ -88,7 +88,7 @@ app-hash = "fwfwfwf"
|
|||
***Only these values are mandatory however you can change or
|
||||
tweak your config see more in advanced configurations below***.
|
||||
```sh
|
||||
touch teldrive.db
|
||||
touch session.db
|
||||
docker compose up -d
|
||||
```
|
||||
- **Go to http://localhost:8080**
|
||||
|
@ -149,6 +149,7 @@ teldrive run --help
|
|||
| --tg-rate-limit | Enable rate limiting | No | true |
|
||||
| --tg-rate-burst | Limiting burst | No | 5 |
|
||||
| --tg-rate | Limiting rate | No | 100 |
|
||||
| --tg-session-file | Bot Session File file. | No | $HOME/.teldrive/session.db |
|
||||
| --tg-bg-bots-limit | Start at most this no of bots in the background to prevent connection recreation on every request.Increase this if you are streaming or downloading large no of files simultaneously. | No | 5
|
||||
| --tg-uploads-threads | Concurrent Uploads threads for uploading file | No | 16 |
|
||||
| --tg-uploads-retention | Uploads retention duration.Duration to keep failed uploaded chunks in db for resuming uploads. | No | 360h (30 days) |
|
||||
|
|
|
@ -6,7 +6,7 @@ services:
|
|||
restart: always
|
||||
container_name: teldrive
|
||||
volumes:
|
||||
- ./teldrive.db:/teldrive.db:rw
|
||||
- ./session.db:/session.db:rw
|
||||
- ./config.toml:/config.toml
|
||||
env_file: teldrive.env
|
||||
ports:
|
||||
|
|
|
@ -6,7 +6,7 @@ services:
|
|||
restart: always
|
||||
container_name: teldrive
|
||||
volumes:
|
||||
- ./teldrive.db:/teldrive.db:rw
|
||||
- ./session.db:/session.db:rw
|
||||
- ./config.toml:/config.toml
|
||||
ports:
|
||||
- 8080:8080
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
FROM scratch
|
||||
COPY teldrive /teldrive
|
||||
EXPOSE 8080
|
||||
ENTRYPOINT ["/teldrive","run"]
|
||||
ENTRYPOINT ["/teldrive","run","--tg-session-file","/session.db"]
|
|
@ -1,11 +1,13 @@
|
|||
package kv
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"time"
|
||||
|
||||
"github.com/divyam234/teldrive/internal/config"
|
||||
"github.com/divyam234/teldrive/internal/utils"
|
||||
"github.com/mitchellh/go-homedir"
|
||||
"go.etcd.io/bbolt"
|
||||
)
|
||||
|
||||
|
@ -46,7 +48,17 @@ func NewBoltKV(cnf *config.Config) KV {
|
|||
|
||||
sessionFile := cnf.TG.SessionFile
|
||||
if sessionFile == "" {
|
||||
sessionFile = filepath.Join(utils.ExecutableDir(), "teldrive.db")
|
||||
dir, err := homedir.Dir()
|
||||
if err != nil {
|
||||
dir = utils.ExecutableDir()
|
||||
} else {
|
||||
dir = filepath.Join(dir, ".teldrive")
|
||||
err := os.Mkdir(dir, 0755)
|
||||
if err != nil && !os.IsExist(err) {
|
||||
dir = utils.ExecutableDir()
|
||||
}
|
||||
}
|
||||
sessionFile = filepath.Join(dir, "session.db")
|
||||
}
|
||||
boltDB, err := bbolt.Open(sessionFile, 0666, &bbolt.Options{
|
||||
Timeout: time.Second,
|
||||
|
|
Loading…
Reference in a new issue