Commit ca168df8 by 孙龙

init

parent 7cdc868d
......@@ -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
......
......@@ -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)
}
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