Commit ca168df8 by 孙龙

init

parent 7cdc868d
...@@ -2,6 +2,8 @@ package apiMsgService ...@@ -2,6 +2,8 @@ package apiMsgService
import ( import (
"fmt" "fmt"
"go-api-behavior/util"
//"fmt" //"fmt"
"go.mongodb.org/mongo-driver/mongo" "go.mongodb.org/mongo-driver/mongo"
"context" "context"
...@@ -89,7 +91,7 @@ func InitLogSink() (err error) { ...@@ -89,7 +91,7 @@ func InitLogSink() (err error) {
) )
// 建立mongodb连接 // 建立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( if client, err = mongo.Connect(
context.TODO(),clientOptions); err != nil { context.TODO(),clientOptions); err != nil {
return return
......
...@@ -12,6 +12,7 @@ type Config struct{ ...@@ -12,6 +12,7 @@ type Config struct{
Crm_domain *SendMail Crm_domain *SendMail
Ding_msg *Ding Ding_msg *Ding
Api_domain *ApiDomain Api_domain *ApiDomain
Mongodb_databases *MongodbDatabases
} }
...@@ -27,6 +28,10 @@ type RabbitmqIchunt struct { ...@@ -27,6 +28,10 @@ type RabbitmqIchunt struct {
Dns string `toml:"dns"` Dns string `toml:"dns"`
} }
type MongodbDatabases struct {
Dns string `toml:"dns"`
}
type SendMail struct{ type SendMail struct{
SendMailUrl string `toml:"send_mail"` SendMailUrl string `toml:"send_mail"`
} }
...@@ -57,4 +62,5 @@ func Init(ConfigDir string){ ...@@ -57,4 +62,5 @@ func Init(ConfigDir string){
// //
//fmt.Printf("%+v",Configs.Crm_domain) //fmt.Printf("%+v",Configs.Crm_domain)
//fmt.Printf("%+v",Configs.Rabbitmq_ichunt) //fmt.Printf("%+v",Configs.Rabbitmq_ichunt)
//fmt.Printf("%+v",Configs.Mongodb_databases)
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment