Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
孙龙
/
go-api-behavior
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
ca168df8
authored
Mar 23, 2020
by
孙龙
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
init
parent
7cdc868d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
1 deletions
service/behavior/apiMsgService/LogSink.go
util/config.go
service/behavior/apiMsgService/LogSink.go
View file @
ca168df8
...
...
@@ -2,6 +2,8 @@ package apiMsgService
import
(
"fmt"
"go-api-behavior/util"
//"fmt"
"go.mongodb.org/mongo-driver/mongo"
"context"
...
...
@@ -89,7 +91,7 @@ func InitLogSink() (err error) {
)
// 建立mongodb连接
clientOptions
:=
options
.
Client
()
.
ApplyURI
(
"mongodb://ichunt:huntmon6699@192.168.1.237:27017/ichunt?authMechanism=SCRAM-SHA-1"
)
clientOptions
:=
options
.
Client
()
.
ApplyURI
(
util
.
Configs
.
Mongodb_databases
.
Dns
)
if
client
,
err
=
mongo
.
Connect
(
context
.
TODO
(),
clientOptions
);
err
!=
nil
{
return
...
...
util/config.go
View file @
ca168df8
...
...
@@ -12,6 +12,7 @@ type Config struct{
Crm_domain
*
SendMail
Ding_msg
*
Ding
Api_domain
*
ApiDomain
Mongodb_databases
*
MongodbDatabases
}
...
...
@@ -27,6 +28,10 @@ type RabbitmqIchunt struct {
Dns
string
`toml:"dns"`
}
type
MongodbDatabases
struct
{
Dns
string
`toml:"dns"`
}
type
SendMail
struct
{
SendMailUrl
string
`toml:"send_mail"`
}
...
...
@@ -57,4 +62,5 @@ func Init(ConfigDir string){
//
//fmt.Printf("%+v",Configs.Crm_domain)
//fmt.Printf("%+v",Configs.Rabbitmq_ichunt)
//fmt.Printf("%+v",Configs.Mongodb_databases)
}
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