Skip to content

Commit

Permalink
fix: remove internal writer dep
Browse files Browse the repository at this point in the history
  • Loading branch information
akurilov committed Jul 23, 2024
1 parent cd0de2b commit 01fdefd
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 75 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.22.4-alpine3.20 AS builder
FROM golang:1.22.5-alpine3.20 AS builder
WORKDIR /go/src/bot-telegram
COPY . .
RUN \
Expand Down
3 changes: 0 additions & 3 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ type Config struct {
}
Uri string `envconfig:"API_URI" default:"api:50051" required:"true"`
Reader ReaderConfig
Writer struct {
Uri string `envconfig:"API_WRITER_URI" default:"resolver:50051" required:"true"`
}
}
Payment PaymentConfig
Log struct {
Expand Down
15 changes: 6 additions & 9 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ go 1.22

require (
github.com/awakari/client-sdk-go v1.1.0
github.com/bytedance/sonic v1.11.9
github.com/cenkalti/backoff/v4 v4.3.0
github.com/cloudevents/sdk-go/binding/format/protobuf/v2 v2.15.2
github.com/cloudevents/sdk-go/v2 v2.15.2
github.com/electrofocus/telegram-auth-verifier v1.1.1
github.com/gin-gonic/gin v1.10.0
github.com/google/uuid v1.6.0
github.com/kelseyhightower/envconfig v1.4.0
github.com/microcosm-cc/bluemonday v1.0.26
github.com/microcosm-cc/bluemonday v1.0.27
github.com/stretchr/testify v1.9.0
google.golang.org/grpc v1.65.0
google.golang.org/protobuf v1.34.2
Expand All @@ -20,7 +21,6 @@ require (

require (
github.com/aymerick/douceur v0.2.0 // indirect
github.com/bytedance/sonic v1.11.9 // indirect
github.com/bytedance/sonic/loader v0.1.1 // indirect
github.com/cloudwego/base64x v0.1.4 // indirect
github.com/cloudwego/iasm v0.2.0 // indirect
Expand All @@ -34,22 +34,19 @@ require (
github.com/gorilla/css v1.0.1 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/cpuid/v2 v2.2.8 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/leodido/go-urn v1.4.0 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/rogpeppe/go-internal v1.12.0 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/ugorji/go/codec v1.2.12 // indirect
golang.org/x/arch v0.8.0 // indirect
golang.org/x/crypto v0.24.0 // indirect
golang.org/x/net v0.26.0 // indirect
golang.org/x/sys v0.21.0 // indirect
golang.org/x/crypto v0.25.0 // indirect
golang.org/x/net v0.27.0 // indirect
golang.org/x/sys v0.22.0 // indirect
golang.org/x/text v0.16.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240723171418-e6d459c13d2a // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
57 changes: 10 additions & 47 deletions go.sum

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions helm/bot-telegram/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ spec:
value: "{{ .Values.api.admin.uri }}"
- name: API_MESSAGES_URI
value: "{{ .Values.api.messages.uri }}"
- name: API_WRITER_URI
value: "{{ .Values.api.writer.uri }}"
- name: API_READER_URI
value: "{{ .Values.api.reader.uri }}"
- name: API_READER_CALLBACK_PROTOCOL
Expand Down
2 changes: 0 additions & 2 deletions helm/bot-telegram/values-gke-cluster-0.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
api:
messages:
uri: "messages:50051"
writer:
uri: "resolver:50051"

# prod
cert:
Expand Down
2 changes: 0 additions & 2 deletions helm/bot-telegram/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,6 @@ api:
callback:
protocol: "http"
path: "/v1/chat"
writer:
uri: "resolver:50051"
uri: "api:50051"
cert: server-cert
telegram:
Expand Down
11 changes: 2 additions & 9 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,6 @@ func main() {
svcMsgs := grpcApiMsgs.NewService(clientMsgs)
svcMsgs = grpcApiMsgs.NewServiceLogging(svcMsgs, log)

// init the internal Awakari messages writer client that bypasses the limits
clientAwkInternal, err := api.
NewClientBuilder().
WriterUri(cfg.Api.Writer.Uri).
Build()
defer clientAwkInternal.Close()

// init websub reader
clientHttp := http.Client{}
svcReader := reader.NewService(&clientHttp, cfg.Api.Reader.Uri)
Expand Down Expand Up @@ -170,12 +163,12 @@ func main() {
preCheckoutHandlers := map[string]service.ArgHandlerFunc{
usage.PurposeLimitSet: limitsHandler.PreCheckout,
subscriptions.PurposeExtend: subExtHandler.ExtensionPreCheckout,
messages.PurposePublish: messages.PublishPreCheckout(svcMsgs, cfg.Payment),
//messages.PurposePublish: messages.PublishPreCheckout(svcMsgs, cfg.Payment),
}
paymentHandlers := map[string]service.ArgHandlerFunc{
usage.PurposeLimitSet: limitsHandler.HandleLimitOrderPaid,
subscriptions.PurposeExtend: subExtHandler.ExtendPaid,
messages.PurposePublish: messages.PublishPaid(svcMsgs, clientAwkInternal, groupId, log, cfg.Payment.Backoff),
//messages.PurposePublish: messages.PublishPaid(svcMsgs, clientAwkInternal, groupId, log, cfg.Payment.Backoff),
}

// init Telegram bot
Expand Down

0 comments on commit 01fdefd

Please sign in to comment.