ing
This commit is contained in:
parent
920f9f8c30
commit
25bb9aca92
|
@ -1,7 +1,6 @@
|
|||
package main
|
||||
|
||||
const (
|
||||
ConfigPathFlagName = "config-dir"
|
||||
ConfigFileName = "config.json"
|
||||
|
||||
GRPCUserIDKey = "GRPCUserID"
|
||||
|
|
4
external/grpc/pool.go
vendored
4
external/grpc/pool.go
vendored
|
@ -1,8 +1,6 @@
|
|||
package grpc
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"google.golang.org/grpc"
|
||||
|
||||
cgp "git.loafle.net/commons_go/grpc_pool"
|
||||
|
@ -23,7 +21,7 @@ func ExternalInit() {
|
|||
grpcPool = cgp.New(ph)
|
||||
|
||||
if err := grpcPool.Start(); nil != err {
|
||||
logging.Logger().Panic(fmt.Sprintf("App: %v", err))
|
||||
logging.Logger().Panicf("App: %v", err)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
|
18
main.go
18
main.go
|
@ -6,6 +6,7 @@ import (
|
|||
cc "git.loafle.net/commons_go/config"
|
||||
"git.loafle.net/commons_go/cors_fasthttp"
|
||||
"git.loafle.net/commons_go/logging"
|
||||
oocc "git.loafle.net/overflow/overflow_commons_go/config"
|
||||
"git.loafle.net/overflow/overflow_server_app/config"
|
||||
"git.loafle.net/overflow/overflow_server_app/external"
|
||||
"git.loafle.net/overflow/overflow_server_app/module/member"
|
||||
|
@ -14,14 +15,21 @@ import (
|
|||
"github.com/valyala/fasthttp"
|
||||
)
|
||||
|
||||
func init() {
|
||||
configPath := flag.String(ConfigPathFlagName, "./", "The path of config file")
|
||||
var (
|
||||
configDir *string
|
||||
logConfigPath *string
|
||||
)
|
||||
|
||||
func init() {
|
||||
configDir = oocc.FlagConfigDir("./")
|
||||
logConfigPath = oocc.FlagLogConfigFilePath("")
|
||||
flag.Parse()
|
||||
|
||||
cc.SetConfigPath(*configPath)
|
||||
if err := cc.Load(&config.Config, ConfigFileName); nil != err {
|
||||
panic(err)
|
||||
logging.InitializeLogger(*logConfigPath)
|
||||
|
||||
cc.SetConfigPath(*configDir)
|
||||
if err := cc.Load(&config.Config, oocc.ConfigFileName); nil != err {
|
||||
logging.Logger().Panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,10 +4,10 @@ import (
|
|||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"log"
|
||||
"net/url"
|
||||
"strings"
|
||||
|
||||
"git.loafle.net/commons_go/logging"
|
||||
"git.loafle.net/overflow/overflow_server_app/external/grpc"
|
||||
"github.com/valyala/fasthttp"
|
||||
)
|
||||
|
@ -30,7 +30,7 @@ func ResetPassword(ctx *fasthttp.RequestCtx) {
|
|||
length := len(webParams)
|
||||
|
||||
if length < 0 {
|
||||
fmt.Println("eeee")
|
||||
logging.Logger().Errorf("eeee")
|
||||
}
|
||||
|
||||
jsonMap := webParams[0].(map[string]interface{})
|
||||
|
@ -49,6 +49,6 @@ func ResetPassword(ctx *fasthttp.RequestCtx) {
|
|||
r, err := grpc.Exec(gRPCCtx, "MemberService.resetPassword", grpcParams)
|
||||
|
||||
ctx.SetContentType("application/javascript")
|
||||
log.Printf("M:%s", r)
|
||||
logging.Logger().Debugf("M:%s", r)
|
||||
ctx.SetBody([]byte(r))
|
||||
}
|
||||
|
|
|
@ -164,7 +164,7 @@ func SigninByCookie(ctx *fasthttp.RequestCtx) {
|
|||
var ok bool
|
||||
var claims jwt.MapClaims
|
||||
if claims, ok = token.Claims.(jwt.MapClaims); !ok || !token.Valid {
|
||||
logging.Logger().Warn(fmt.Sprintf("Webapp: Token is not valid %v", token))
|
||||
logging.Logger().Warnf("Webapp: Token is not valid %v", token)
|
||||
|
||||
err = errors.New("authToken is invalid")
|
||||
commons.SendRESTError(ctx, fasthttp.StatusBadRequest, err)
|
||||
|
|
Loading…
Reference in New Issue
Block a user