animeic 2 years ago
parent
commit
b76cbad8f9
6 changed files with 12 additions and 4 deletions
  1. 1 0
      boxcost/api/router.go
  2. 7 0
      boxcost/api/test_print.go
  3. 1 1
      boxcost/app.yaml
  4. 1 1
      boxcost/db/db.go
  5. 1 1
      boxcost/db/redis.go
  6. 1 1
      boxcost/main.go

+ 1 - 0
boxcost/api/router.go

@@ -11,6 +11,7 @@ func RegRouters(svc *Service) {
 
 	boxcost := svc.NewGinRouter("/" + svc.Conf.Name)
 	boxcost.group.Use(Logger())
+	boxcost.GET("/printr", Printr)
 
 }
 

+ 7 - 0
boxcost/api/test_print.go

@@ -0,0 +1,7 @@
+package api
+
+import "github.com/gin-gonic/gin"
+
+func Printr(c *gin.Context, apictx *ApiSession) (interface{}, error) {
+	return "aaa", nil
+}

+ 1 - 1
boxcost/app.yaml

@@ -1,4 +1,4 @@
-port: 8902
+port: 8888
 name: boxcost
 version: 1.0.0
 jwt: 

+ 1 - 1
boxcost/db/db.go

@@ -35,7 +35,7 @@ func (db *MongoDB) GetOrCreateDatabase(name string) *mongo.Database {
 }
 
 func NewMongoDB(bus *comm.NatsBus) *MongoDB {
-	inst, err := bus.NewMongoDBFromConfig("boxcost")
+	inst, err := bus.NewMongoDBFromConfig("box-mongo")
 	if err != nil {
 		panic(err)
 	}

+ 1 - 1
boxcost/db/redis.go

@@ -6,7 +6,7 @@ import (
 )
 
 func NewRedisClient(bus *comm.NatsBus) *redis.Client {
-	client, err := bus.NewRedisFromConfig("redis")
+	client, err := bus.NewRedisFromConfigDev("box-redis")
 	if err != nil {
 		return nil
 	}

+ 1 - 1
boxcost/main.go

@@ -35,7 +35,7 @@ func main() {
 	flag.Parse()
 	app := BuildApp()
 
-	err := app.Invoke(func(svc *api.Service, bus *comm.NatsBus) error {
+	err := app.Invoke(func(svc *api.Service, config *conf.AppConf, bus *comm.NatsBus) error {
 		go bus.Run()
 
 		svc.Run()