Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
2
22a7f0099
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Summer2022
22a7f0099
Commits
dc7e5d08
Commit
dc7e5d08
authored
5 years ago
by
邹毅贤
Browse files
Options
Downloads
Patches
Plain Diff
fix review comment
parent
2f33bf00
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
config/condition_router_config.go
+2
-12
2 additions, 12 deletions
config/condition_router_config.go
config/condition_router_config_test.go
+1
-1
1 addition, 1 deletion
config/condition_router_config_test.go
with
3 additions
and
13 deletions
config/condition_router_config.go
+
2
−
12
View file @
dc7e5d08
...
...
@@ -20,7 +20,6 @@ package config
import
(
"encoding/base64"
"net/url"
"os"
"strconv"
"strings"
"sync"
...
...
@@ -59,20 +58,11 @@ func RouterInit(confRouterFile string) error {
}
logger
.
Debugf
(
"router config{%#v}
\n
"
,
routerConfig
)
directory
.
AddRouterURLSet
(
initRouterUrl
())
directory
.
AddRouterURLSet
(
initRouterUrl
(
routerConfig
))
return
nil
}
func
initRouterUrl
()
*
common
.
URL
{
mutex
.
Lock
()
if
routerConfig
==
nil
{
confRouterFile
:=
os
.
Getenv
(
constant
.
CONF_ROUTER_FILE_PATH
)
err
:=
RouterInit
(
confRouterFile
)
if
err
!=
nil
{
return
nil
}
}
mutex
.
Unlock
()
func
initRouterUrl
(
routerConfig
*
ConditionRouterConfig
)
*
common
.
URL
{
rule
:=
parseCondition
(
routerConfig
.
Conditions
)
return
common
.
NewURLWithOptions
(
...
...
This diff is collapsed.
Click to expand it.
config/condition_router_config_test.go
+
1
−
1
View file @
dc7e5d08
...
...
@@ -73,7 +73,7 @@ func TestParseCondition(t *testing.T) {
func
TestInitRouterUrl
(
t
*
testing
.
T
)
{
routerConfig
=
&
ConditionRouterConfig
{}
loadYmlConfig
(
testyml
,
routerConfig
)
url
:=
initRouterUrl
()
url
:=
initRouterUrl
(
routerConfig
)
assert
.
Equal
(
t
,
url
.
Protocol
,
"route"
)
assert
.
Equal
(
t
,
url
.
Ip
,
"0.0.0.0"
)
}
This diff is collapsed.
Click to expand it.
Preview
0%
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