Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
2
22a7f0099
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Summer2022
22a7f0099
Commits
392fb859
Commit
392fb859
authored
Apr 17, 2020
by
Xargin
Browse files
Options
Downloads
Patches
Plain Diff
a little refactor
parent
cd5504a8
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
common/url.go
+6
-4
6 additions, 4 deletions
common/url.go
config/config_loader.go
+107
-97
107 additions, 97 deletions
config/config_loader.go
with
113 additions
and
101 deletions
common/url.go
+
6
−
4
View file @
392fb859
...
...
@@ -264,17 +264,19 @@ func (c URL) URLEqual(url URL) bool {
}
else
if
urlGroup
==
constant
.
ANY_VALUE
{
urlKey
=
strings
.
Replace
(
urlKey
,
"group=*"
,
"group="
+
cGroup
,
1
)
}
// 1. protocol, username, password, ip, port, service name, group, version should be equal
if
cKey
!=
urlKey
{
return
false
}
// 2. if url contains enabled key, should be true, or *
if
url
.
GetParam
(
constant
.
ENABLED_KEY
,
"true"
)
!=
"true"
&&
url
.
GetParam
(
constant
.
ENABLED_KEY
,
""
)
!=
constant
.
ANY_VALUE
{
return
false
}
//TODO :may need add interface key any value condition
if
!
isMatchCategory
(
url
.
GetParam
(
constant
.
CATEGORY_KEY
,
constant
.
DEFAULT_CATEGORY
),
c
.
GetParam
(
constant
.
CATEGORY_KEY
,
constant
.
DEFAULT_CATEGORY
))
{
return
false
}
return
true
return
isMatchCategory
(
url
.
GetParam
(
constant
.
CATEGORY_KEY
,
constant
.
DEFAULT_CATEGORY
),
c
.
GetParam
(
constant
.
CATEGORY_KEY
,
constant
.
DEFAULT_CATEGORY
))
}
func
isMatchCategory
(
category1
string
,
category2
string
)
bool
{
...
...
This diff is collapsed.
Click to expand it.
config/config_loader.go
+
107
−
97
View file @
392fb859
...
...
@@ -81,20 +81,11 @@ func checkApplicationName(config *ApplicationConfig) {
}
}
// Load Dubbo Init
func
Load
()
{
// init router
if
confRouterFile
!=
""
{
if
errPro
:=
RouterInit
(
confRouterFile
);
errPro
!=
nil
{
log
.
Printf
(
"[routerConfig init] %#v"
,
errPro
)
}
}
// reference config
func
loadConsumerConfig
()
{
if
consumerConfig
==
nil
{
logger
.
Warnf
(
"consumerConfig is nil!"
)
}
else
{
return
}
// init other consumer config
conConfigType
:=
consumerConfig
.
ConfigType
for
key
,
value
:=
range
extension
.
GetDefaultConfigReader
()
{
...
...
@@ -164,10 +155,12 @@ func Load() {
}
}
// service c
onfig
func
loadProviderC
onfig
()
{
if
providerConfig
==
nil
{
logger
.
Warnf
(
"providerConfig is nil!"
)
}
else
{
return
}
// init other provider config
proConfigType
:=
providerConfig
.
ConfigType
for
key
,
value
:=
range
extension
.
GetDefaultConfigReader
()
{
...
...
@@ -203,6 +196,23 @@ func Load() {
}
}
}
// Load Dubbo Init
func
Load
()
{
// init router
if
confRouterFile
!=
""
{
if
errPro
:=
RouterInit
(
confRouterFile
);
errPro
!=
nil
{
log
.
Printf
(
"[routerConfig init] %#v"
,
errPro
)
}
}
// reference config
loadConsumerConfig
()
// service config
loadProviderConfig
()
// init the shutdown callback
GracefulShutdownInit
()
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment