Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
H
hilo-userCenter
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hujiebin
hilo-userCenter
Commits
a1a9b2c5
Commit
a1a9b2c5
authored
Oct 23, 2023
by
hujiebin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
本地不注册
parent
b7ad676a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
1 deletion
+9
-1
config.go
common/config/config.go
+4
-0
main.go
main.go
+5
-1
No files found.
common/config/config.go
View file @
a1a9b2c5
...
...
@@ -17,6 +17,10 @@ func AppIsRelease() bool {
return
GetMode
()
==
RELEASE
}
func
AppIsLocal
()
bool
{
return
GetMode
()
==
LOCAL
}
//数据库的配置
type
MysqlConfig
struct
{
MYSQL_HOST
string
...
...
main.go
View file @
a1a9b2c5
...
...
@@ -504,6 +504,10 @@ const (
)
func
RegisterToRedis
(
RedisClusterClient
*
redis
.
Client
,
port
int
,
init
bool
)
{
// 本地不注册
if
appConfig
.
AppIsLocal
()
{
return
}
if
RedisClusterClient
==
nil
{
failMsg
:=
fmt
.
Sprintf
(
"RegisterToRedis fail,redisClusterNotInit,serviceName:%v"
,
RegisterName
)
_
=
dingding
.
SendDingRobot
(
dingding
.
ROBOTWEBHOOK
,
failMsg
,
true
)
...
...
@@ -522,7 +526,7 @@ func RegisterToRedis(RedisClusterClient *redis.Client, port int, init bool) {
if
err
:=
RedisClusterClient
.
ZAdd
(
context
.
Background
(),
redisKey
,
&
redis
.
Z
{
Score
:
float64
(
time
.
Now
()
.
Unix
()),
Member
:
ipPort
,
});
err
!=
nil
{
})
.
Err
()
;
err
!=
nil
{
failMsg
:=
fmt
.
Sprintf
(
"RegisterToRedis fail,redis fail,err:%v,serviceName:%v"
,
err
,
RegisterName
)
mylogrus
.
MyLog
.
Errorf
(
failMsg
)
_
=
dingding
.
SendDingRobot
(
dingding
.
ROBOTWEBHOOK
,
failMsg
,
true
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment