Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Jun 2, 2023. It is now read-only.
/golangci-apiPublic archive

Commitd3e4b86

Browse files
committed
support NEED_CHECK_ACTIVE_SUBSCRIPTIONS
1 parent3a74761 commitd3e4b86

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

‎go.sum‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+Ce
2929
github.com/bombsimon/wslv1.2.1/go.mod h1:43lEF/i0kpXbLCeDXL9LMT8c92HyBywXb0AsgMHYngM=
3030
github.com/cenkalti/backoffv2.2.0+incompatible h1:8qVbEY6GLhoLlLi1Ac2ZkVhedNwlhQXc39qivKp9+GI=
3131
github.com/cenkalti/backoffv2.2.0+incompatible/go.mod h1:b6Nc7NRH5C4aCISLry0tLnTjcuTEvoiqcWDdsU0sOGM=
32+
github.com/cenkalti/backoffv2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4=
3233
github.com/cenkalti/backoffv2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM=
3334
github.com/cenkalti/backoff/v4v4.0.0/go.mod h1:eEew/i+1Q6OrCDZh3WiXYv3+nJwBASZ8Bog/87DQnVg=
3435
github.com/certifi/gocertifiv0.0.0-20190506164543-d2eda7129713 h1:UNOqI3EKhvbqV8f1Vm3NIwkrhq388sGCeAH2Op7w0rc=
@@ -231,6 +232,7 @@ github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
231232
github.com/kr/textv0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
232233
github.com/levigross/grequestsv0.0.0-20190130132859-37c80f76a0da h1:ixpx9UaTDElZrjbd9GeOVG4Deut0FFumoeel7PvVNm4=
233234
github.com/levigross/grequestsv0.0.0-20190130132859-37c80f76a0da/go.mod h1:uCZIhROSrVmuF/BPYFPwDeiiQ6juSLp0kikFoEcNcEs=
235+
github.com/levigross/grequestsv0.0.0-20190908174114-253788527a1a h1:DGFy/362j92vQRE3ThU1yqg9TuJS8YJOSbQuB7BP9cA=
234236
github.com/levigross/grequestsv0.0.0-20190908174114-253788527a1a/go.mod h1:jVntzcUU+2BtVohZBQmSHWUmh8B55LCNfPhcNCIvvIg=
235237
github.com/lib/pqv1.1.1 h1:sJZmqHoEaY7f+NPP8pgLB/WxulyR3fewgCM2qaSlBb4=
236238
github.com/lib/pqv1.1.1/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
@@ -292,6 +294,7 @@ github.com/pkg/errors v0.8.0 h1:WdK/asTD0HN+q6hsWO3/vpuAkAr+tw6aNJNDFFf0+qw=
292294
github.com/pkg/errorsv0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
293295
github.com/pkg/errorsv0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
294296
github.com/pkg/errorsv0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
297+
github.com/pkg/errorsv0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
295298
github.com/pkg/errorsv0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
296299
github.com/pmezard/go-difflibv1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
297300
github.com/pmezard/go-difflibv1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=

‎pkg/api/app.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ func (a *App) buildDeps() {
202202
a.policies.org=policy.NewOrganization(a.providerFactory,a.cache,a.cfg,a.trackedLog)
203203
}
204204
ifa.policies.activeSub==nil {
205-
a.policies.activeSub=policy.NewActiveSubscription(a.trackedLog,a.gormDB)
205+
a.policies.activeSub=policy.NewActiveSubscription(a.trackedLog,a.gormDB,a.cfg)
206206
}
207207
ifa.policies.repo==nil {
208208
a.policies.repo=policy.NewRepo(a.providerFactory,a.cfg,a.trackedLog,a.cache,a.authorizer)

‎pkg/api/policy/active_subscription.go‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"strings"
66

7+
"github.com/golangci/golangci-api/internal/shared/config"
78
"github.com/golangci/golangci-api/internal/shared/logutil"
89
"github.com/golangci/golangci-api/internal/shared/providers/provider"
910
"github.com/golangci/golangci-api/pkg/api/models"
@@ -14,12 +15,14 @@ import (
1415
typeActiveSubscriptionstruct {
1516
log logutil.Log
1617
db*gorm.DB
18+
cfg config.Config
1719
}
1820

19-
funcNewActiveSubscription(log logutil.Log,db*gorm.DB)*ActiveSubscription {
21+
funcNewActiveSubscription(log logutil.Log,db*gorm.DB,cfg config.Config)*ActiveSubscription {
2022
return&ActiveSubscription{
2123
log:log,
2224
db:db,
25+
cfg:cfg,
2326
}
2427
}
2528

@@ -48,6 +51,11 @@ func (s ActiveSubscription) checkExistingOrgSubscription(org *models.Org) (*mode
4851
}
4952

5053
func (sActiveSubscription)CheckForProviderRepo(p provider.Provider,pr*provider.Repo)error {
54+
if!s.cfg.GetBool("NEED_CHECK_ACTIVE_SUBSCRIPTIONS",true) {
55+
s.log.Infof("Don't check active subscription by config")
56+
returnnil
57+
}
58+
5159
_,_,err:=s.getActiveSub(p,pr)
5260
returnerr
5361
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp