Skip to content

Commit ebaec0c

Browse files
authored
feat: use go tools for golang binary dependencies (#809)
* upd * upd * upd
1 parent 10f9225 commit ebaec0c

File tree

25 files changed

+2499
-442
lines changed

25 files changed

+2499
-442
lines changed

.env.example

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@
22
BOT_ACCESS_TOKEN=
33
BOT_REFRESH_TOKEN=
44

5-
SITE_BASE_URL=localhost:3005
5+
SITE_BASE_URL=http://localhost:3005
66

77
TWITCH_CLIENTID=
88
TWITCH_CLIENTSECRET=
9-
TWITCH_CALLBACKURL=http://$SITE_BASE_URL/login
109

1110
# you can get the token from https://dashboard.ngrok.com/get-started/your-authtoken
1211
NGROK_AUTH_TOKEN=

.github/workflows/build-and-lint.yml

+1-21
Original file line numberDiff line numberDiff line change
@@ -20,28 +20,8 @@ jobs:
2020
with:
2121
bun-version-file: ".bun-version"
2222

23-
- name: Cache node_modules
24-
id: cache-node_modules
25-
uses: actions/cache@v4
26-
with:
27-
path: node_modules
28-
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/bun.lock') }}
29-
restore-keys: |
30-
${{ runner.os }}-node_modules-
31-
- name: Install js
32-
if: steps.cache-node_modules.outputs.cache-hit != 'true'
33-
run: bun install
34-
3523
- name: Install go dependencies
36-
run: bun cli deps --skip-node
24+
run: bun cli deps
3725

3826
- name: Build
3927
run: bun cli build
40-
41-
# - name: Lint javascript
42-
# run: pnpm run lint
43-
44-
# - name: golangci-lint
45-
# uses: golangci/golangci-lint-action@v3
46-
# with:
47-
# version: v1.55.2

Caddyfile.dev

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
http://localhost:3005 https://twir.localhost {
1+
{$SITE_BASE_URL} {
22
reverse_proxy http://127.0.0.1:3010
33

44
handle_path /api/* {

README.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,9 @@ We'll use `twir.localhost` domain, which is enables ability to grant ssl out of
7272

7373
* Add `https://twir.localhost/login` to your twitch application redirect url's
7474

75-
* Edit `.env`, change site base url and protocol for twitch callback:
75+
* Edit `.env`, change site base url:
7676
```ini
77-
SITE_BASE_URL=twir.localhost
78-
TWITCH_CALLBACKURL=https://$SITE_BASE_URL/login
77+
SITE_BASE_URL=https://twir.localhost
7978
```
8079

8180
* Start application as usual:

apps/api-gql/internal/delivery/gql/resolvers/user.resolver.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/api/internal/impl_protected/integrations/discord.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ func (c *Integrations) IntegrationsDiscordGetAuthLink(
3131
return nil, errors.New("discord not enabled on our side, please be patient")
3232
}
3333

34-
redirectUrl := fmt.Sprintf("http://%s/dashboard/integrations/discord", c.Config.SiteBaseUrl)
34+
redirectUrl := fmt.Sprintf("%s/dashboard/integrations/discord", c.Config.SiteBaseUrl)
3535

3636
q := u.Query()
3737
q.Add("client_id", c.Config.DiscordClientID)
@@ -242,7 +242,7 @@ func (c *Integrations) IntegrationDiscordConnectGuild(
242242
"grant_type": "authorization_code",
243243
"code": data.GetCode(),
244244
"redirect_uri": fmt.Sprintf(
245-
"http://%s/dashboard/integrations/discord",
245+
"%s/dashboard/integrations/discord",
246246
c.Config.SiteBaseUrl,
247247
),
248248
},

apps/eventsub/internal/tunnel/tunnel.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"fmt"
66
"log/slog"
77
"net"
8+
"net/url"
89
"time"
910

1011
"github.com/avast/retry-go/v4"
@@ -69,12 +70,14 @@ func New(cfg config.Config, lc fx.Lifecycle, log logger.Logger) (*AppTunnel, err
6970
}
7071

7172
func (c *AppTunnel) GetAddr() string {
73+
baseUrl, _ := url.Parse(c.cfg.SiteBaseUrl)
74+
7275
return lo.
7376
If(
7477
c.cfg.AppEnv != "production",
7578
"https://"+c.Listener.Addr().String(),
7679
).
77-
Else(fmt.Sprintf("https://eventsub.%s", c.cfg.SiteBaseUrl))
80+
Else(fmt.Sprintf("https://eventsub.%s", baseUrl.Host))
7881
}
7982

8083
func createDefaultTun() (net.Listener, error) {

apps/parser/internal/commands/songrequest/youtube/list.go

+3-6
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ import (
77
"github.com/guregu/null"
88
"github.com/satont/twir/apps/parser/internal/types"
99

10-
"github.com/samber/lo"
11-
1210
model "github.com/satont/twir/libs/gomodels"
1311
)
1412

@@ -27,14 +25,13 @@ var SrListCommand = &types.DefaultCommand{
2725
) {
2826
result := &types.CommandsHandlerResult{}
2927

30-
url := fmt.Sprintf(
31-
"%s://%s/p/%s/songs-requests",
32-
lo.If(parseCtx.Services.Config.AppEnv == "development", "http").Else("https"),
28+
link := fmt.Sprintf(
29+
"%s/p/%s/songs-requests",
3330
parseCtx.Services.Config.SiteBaseUrl,
3431
parseCtx.Channel.Name,
3532
)
3633

37-
result.Result = append(result.Result, url)
34+
result.Result = append(result.Result, link)
3835
return result, nil
3936
},
4037
}

apps/tokens/internal/grpc_impl/grpc_impl.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ func NewTokens(opts Opts) error {
7878
&helix.Options{
7979
ClientID: opts.Config.TwitchClientId,
8080
ClientSecret: opts.Config.TwitchClientSecret,
81-
RedirectURI: opts.Config.TwitchCallbackUrl,
81+
RedirectURI: opts.Config.GetTwitchCallbackUrl(),
8282
RateLimitFunc: rateLimitFunc,
8383
},
8484
)

0 commit comments

Comments
 (0)