Skip to content

Commit 5d98a1d

Browse files
authored
Revert "Improve codecov (#1384)" (#1387)
This reverts commit 060a9e5.
1 parent 060a9e5 commit 5d98a1d

File tree

192 files changed

+10432
-7595
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

192 files changed

+10432
-7595
lines changed

.github/workflows/codecov.yaml

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -61,25 +61,13 @@ jobs:
6161
with:
6262
fetch-depth: 2
6363

64-
- uses: shogo82148/actions-setup-mysql@v1
65-
with:
66-
mysql-version: "5.7"
67-
auto-start: true
68-
my-cnf: |
69-
innodb_log_file_size=256MB
70-
innodb_buffer_pool_size=512MB
71-
max_allowed_packet=16MB
72-
max_connections=50
73-
local_infile=1
74-
root-password: root
75-
76-
7764
- name: Initialize database
7865
env:
7966
MYSQL_DB_USER: root
8067
MYSQL_DB_PWD: root
8168
MYSQL_DATABASE: polaris_server
8269
run: |
70+
sudo systemctl start mysql.service
8371
mysql -e 'CREATE DATABASE ${{ env.MYSQL_DATABASE }};' -u${{ env.MYSQL_DB_USER }} -p${{ env.MYSQL_DB_PWD }}
8472
mysql -e "ALTER USER '${{ env.MYSQL_DB_USER }}'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root';" -u${{ env.MYSQL_DB_USER }} -p${{ env.MYSQL_DB_PWD }}
8573

.golangci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ linters-settings:
167167
disabled: false
168168
- name: max-public-structs
169169
severity: warning
170-
disabled: true
170+
disabled: false
171171
arguments: [35]
172172
- name: indent-error-flow
173173
severity: warning
@@ -281,7 +281,7 @@ linters-settings:
281281
govet:
282282
# Report about shadowed variables.
283283
# Default: false
284-
shadow: false
284+
check-shadowing: true
285285
# Settings per analyzer.
286286
settings:
287287
# Analyzer name, run `go tool vet help` to see all analyzers.

admin/api.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import (
2525

2626
"github.com/polarismesh/polaris/common/model"
2727
"github.com/polarismesh/polaris/common/model/admin"
28-
authcommon "github.com/polarismesh/polaris/common/model/auth"
2928
)
3029

3130
// AdminOperateServer Maintain related operation
@@ -56,6 +55,4 @@ type AdminOperateServer interface {
5655
GetCMDBInfo(ctx context.Context) ([]model.LocationView, error)
5756
// InitMainUser
5857
InitMainUser(ctx context.Context, user apisecurity.User) error
59-
// GetServerFunctions Get server functions
60-
GetServerFunctions(ctx context.Context) []authcommon.ServerFunctionGroup
6158
}

admin/config.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ import (
2323

2424
// Config maintain configuration
2525
type Config struct {
26-
Jobs []job.JobConfig `yaml:"jobs"`
27-
Interceptors []string `yaml:"-"`
26+
Jobs []job.JobConfig `yaml:"jobs"`
2827
}
2928

3029
func DefaultConfig() *Config {

admin/default.go

Lines changed: 23 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -20,32 +20,21 @@ package admin
2020
import (
2121
"context"
2222
"errors"
23-
"fmt"
2423

2524
"github.com/polarismesh/polaris/admin/job"
25+
"github.com/polarismesh/polaris/auth"
2626
"github.com/polarismesh/polaris/cache"
2727
"github.com/polarismesh/polaris/service"
2828
"github.com/polarismesh/polaris/service/healthcheck"
2929
"github.com/polarismesh/polaris/store"
3030
)
3131

3232
var (
33-
server AdminOperateServer
34-
maintainServer = &Server{}
35-
finishInit bool
36-
serverProxyFactories = map[string]ServerProxyFactory{}
33+
server AdminOperateServer
34+
maintainServer = &Server{}
35+
finishInit bool
3736
)
3837

39-
type ServerProxyFactory func(ctx context.Context, pre AdminOperateServer) (AdminOperateServer, error)
40-
41-
func RegisterServerProxy(name string, factor ServerProxyFactory) error {
42-
if _, ok := serverProxyFactories[name]; ok {
43-
return fmt.Errorf("duplicate ServerProxyFactory, name(%s)", name)
44-
}
45-
serverProxyFactories[name] = factor
46-
return nil
47-
}
48-
4938
// Initialize 初始化
5039
func Initialize(ctx context.Context, cfg *Config, namingService service.DiscoverServer,
5140
healthCheckServer *healthcheck.Server, cacheMgn *cache.CacheManager, storage store.Store) error {
@@ -54,49 +43,40 @@ func Initialize(ctx context.Context, cfg *Config, namingService service.Discover
5443
return nil
5544
}
5645

57-
proxySvr, actualSvr, err := InitServer(ctx, cfg, namingService, healthCheckServer, cacheMgn, storage)
46+
err := initialize(ctx, cfg, namingService, healthCheckServer, cacheMgn, storage)
5847
if err != nil {
5948
return err
6049
}
6150

62-
server = proxySvr
63-
maintainServer = actualSvr
6451
finishInit = true
6552
return nil
6653
}
6754

68-
func InitServer(ctx context.Context, cfg *Config, namingService service.DiscoverServer,
69-
healthCheckServer *healthcheck.Server, cacheMgn *cache.CacheManager, storage store.Store) (AdminOperateServer, *Server, error) {
55+
func initialize(_ context.Context, cfg *Config, namingService service.DiscoverServer,
56+
healthCheckServer *healthcheck.Server, cacheMgn *cache.CacheManager, storage store.Store) error {
7057

71-
actualSvr := new(Server)
58+
userMgn, err := auth.GetUserServer()
59+
if err != nil {
60+
return err
61+
}
7262

73-
actualSvr.namingServer = namingService
74-
actualSvr.healthCheckServer = healthCheckServer
75-
actualSvr.cacheMgn = cacheMgn
76-
actualSvr.storage = storage
63+
strategyMgn, err := auth.GetStrategyServer()
64+
if err != nil {
65+
return err
66+
}
67+
68+
maintainServer.namingServer = namingService
69+
maintainServer.healthCheckServer = healthCheckServer
70+
maintainServer.cacheMgn = cacheMgn
71+
maintainServer.storage = storage
7772

7873
maintainJobs := job.NewMaintainJobs(namingService, cacheMgn, storage)
7974
if err := maintainJobs.StartMaintianJobs(cfg.Jobs); err != nil {
80-
return nil, nil, err
81-
}
82-
83-
var proxySvr AdminOperateServer
84-
proxySvr = actualSvr
85-
order := GetChainOrder()
86-
for i := range order {
87-
factory, exist := serverProxyFactories[order[i]]
88-
if !exist {
89-
return nil, nil, fmt.Errorf("name(%s) not exist in serverProxyFactories", order[i])
90-
}
91-
92-
afterSvr, err := factory(ctx, proxySvr)
93-
if err != nil {
94-
return nil, nil, err
95-
}
96-
proxySvr = afterSvr
75+
return err
9776
}
9877

99-
return proxySvr, actualSvr, nil
78+
server = newServerAuthAbility(maintainServer, userMgn, strategyMgn)
79+
return nil
10080
}
10181

10282
// GetServer 获取已经初始化好的Server

admin/interceptor/auth/log.go

Lines changed: 0 additions & 24 deletions
This file was deleted.

0 commit comments

Comments
 (0)