Skip to content

Commit

Permalink
auto: autocommit
Browse files Browse the repository at this point in the history
  • Loading branch information
pibragimov committed Apr 23, 2024
1 parent 002192a commit cc27469
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ds/weights.pth
.mtproto*
bootstrap*
### Builds ###
fun-telegram-v*
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v1.11.49
v1.11.50
2 changes: 1 addition & 1 deletion core/presentation/telegram/telegram.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func NewProtoClient(ctx context.Context) (*gotgproto.Client, error) {
InMemory: false,
DisableCopyright: true,
Session: sessionMaker.SqlSession(
sqlite.Open(shared.AppSettings.Telegram.SessionFullPath),
sqlite.Open(".mtproto"),
),
Middlewares: middlewares,
RunMiddleware: runMiddleware,
Expand Down
22 changes: 6 additions & 16 deletions core/shared/settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@ package shared

import (
"context"
"path/filepath"
"time"

"github.com/pkg/errors"

"github.com/caarlos0/env/v7"
"github.com/joho/godotenv"
"github.com/mitchellh/go-homedir"
)

const (
Expand All @@ -18,11 +16,9 @@ const (
)

type telegram struct {
AppID int `env:"app_id,required"`
AppHash string `env:"app_hash,required"`
PhoneNumber string `env:"phone_number,required"`
SessionPath string `env:"session_storage_path" envDefault:"telegram-session.json"`
SessionFullPath string
AppID int `env:"app_id,required"`
AppHash string `env:"app_hash,required"`
PhoneNumber string `env:"phone_number,required"`

FloodWaiterEnabled bool `env:"flood_waiter_enabled" envDefault:"true"`
RateLimiterEnabled bool `env:"rate_limiter_enabled" envDefault:"true"`
Expand All @@ -38,10 +34,9 @@ type storage struct {
}

type Settings struct {
Telegram telegram `envPrefix:"telegram__"`
Storage storage `envPrefix:"storage__"`
FileStoragePath string ` env:"file_storage_path" envDefault:"~/.config/fun-telegram/"`
LogLevel string ` env:"log_level" envDefault:"debug"`
Telegram telegram `envPrefix:"telegram__"`
Storage storage `envPrefix:"storage__"`
LogLevel string ` env:"log_level" envDefault:"debug"`

MessagesMaxSizeMB int `env:"messages_max_size_mb" envDefault:"100"`

Expand All @@ -61,11 +56,6 @@ func mustNewSettings() Settings {
err := env.Parse(&settings, env.Options{Prefix: defaultEnvPrefix})
Check(ctx, errors.Wrap(err, "failed to env parse"))

realPath, err := homedir.Expand(settings.FileStoragePath)
Check(ctx, errors.Wrap(err, "failed to homedir expand"))

settings.Telegram.SessionFullPath = filepath.Join(realPath, settings.Telegram.SessionPath)

return settings
}

Expand Down
2 changes: 1 addition & 1 deletion docker-compose-local.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ services:
context: .
dockerfile: DockerfileCore
volumes:
- "~/.config/fun-telegram:/config"
- ".mtproto:/.mtproto"
- ".env:/.env"
depends_on:
redis:
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ services:
fun_storage__mongo_db_url: "mongodb://mongodb:27017"
fun_storage__clickhouse_url: "clickhouse:9000"
fun_ds_supplier_url: "http://ds:8000"
image: ghcr.io/teadove/fun-telegram:v1.11.49
image: ghcr.io/teadove/fun-telegram:v1.11.50
volumes:
- "~/.config/fun-telegram:/config"
- ".mtproto:/.mtproto"
- ".env:/.env"
depends_on:
redis:
Expand Down
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ require (
github.com/guregu/null/v5 v5.0.0
github.com/joho/godotenv v1.5.1
github.com/kamva/mgm/v3 v3.5.0
github.com/mitchellh/go-homedir v1.1.0
github.com/pkg/errors v0.9.1
github.com/redis/go-redis/v9 v9.4.0
github.com/rs/zerolog v1.31.0
Expand Down
1 change: 0 additions & 1 deletion go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,6 @@ github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D
github.com/minio/md5-simd v1.1.2/go.mod h1:MzdKDxYpY2BT9XQFocsiZf/NKVtR7nkE4RoEpN+20RM=
github.com/minio/minio-go/v7 v7.0.34/go.mod h1:nCrRzjoSUQh8hgKKtu3Y708OLvRLtuASMg2/nvmbarw=
github.com/minio/sha256-simd v1.0.0/go.mod h1:OuYzVNI5vcoYIAmbIvHPl3N3jUzVedXbKy5RFepssQM=
github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
github.com/mitchellh/mapstructure v1.3.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
github.com/mitchellh/mapstructure v1.4.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
Expand Down

0 comments on commit cc27469

Please sign in to comment.