모듈 충돌 해결 및 코드 정리

This commit is contained in:
2023-05-24 15:31:01 +09:00
parent 1fdfe3f45b
commit d38299b90d
14 changed files with 128 additions and 55 deletions

View File

@ -21,8 +21,8 @@ import (
"time"
"unsafe"
"repositories.action2quare.com/ayo/go-ayo/common"
"repositories.action2quare.com/ayo/go-ayo/logger"
common "repositories.action2quare.com/ayo/gocommon"
"repositories.action2quare.com/ayo/gocommon/logger"
"github.com/golang-jwt/jwt"
"go.mongodb.org/mongo-driver/bson"
@ -545,9 +545,17 @@ func (mg *Maingate) RegisterHandlers(ctx context.Context, serveMux *http.ServeMu
w.Write(configraw)
})
if err := os.MkdirAll("static", os.ModePerm); err != nil {
// 일반 엔드유저한테 오픈할 static 페이지
return err
}
fsx := http.FileServer(http.Dir("./console"))
serveMux.Handle(common.MakeHttpHandlerPattern(prefix, "console", "/"), http.StripPrefix("/console/", fsx))
ssx := http.FileServer(http.Dir("./static"))
serveMux.Handle(common.MakeHttpHandlerPattern(prefix, "static", "/"), http.StripPrefix("/static/", ssx))
serveMux.HandleFunc(common.MakeHttpHandlerPattern(prefix, "request_login_url", AuthPlatformGoogle), mg.platform_google_get_login_url)
serveMux.HandleFunc(common.MakeHttpHandlerPattern(prefix, "authorize", AuthPlatformGoogle), mg.platform_google_authorize)
serveMux.HandleFunc(common.MakeHttpHandlerPattern(prefix, "authorize_result", AuthPlatformGoogle), mg.platform_google_authorize_result)
@ -767,7 +775,7 @@ func (mg *Maingate) updateUserinfo(info usertokeninfo) (bool, string, string) {
}
func (mg *Maingate) getProviderInfo(platform string, uid string) (error, string, string) {
func (mg *Maingate) getProviderInfo(platform string, uid string) (string, string, error) {
provider := ""
providerid := ""
@ -778,15 +786,15 @@ func (mg *Maingate) getProviderInfo(platform string, uid string) (error, string,
})
if err != nil {
return err, "", ""
return "", "", err
}
if found == nil {
return errors.New("firebase info not found: " + uid), "", ""
return "", "", errors.New("firebase info not found: " + uid)
}
provider = found["firebaseprovider"].(string)
providerid = found["firebaseproviderId"].(string)
if provider == "" || providerid == "" {
return errors.New("getProviderInfo - firebase info not found: " + provider + " / " + providerid), "", ""
return "", "", errors.New("getProviderInfo - firebase info not found: " + provider + " / " + providerid)
}
default:
provider = platform
@ -794,10 +802,10 @@ func (mg *Maingate) getProviderInfo(platform string, uid string) (error, string,
}
if provider == "" || providerid == "" {
return errors.New("getProviderInfo - provider info not found: " + provider + " / " + providerid), "", ""
return "", "", errors.New("getProviderInfo - provider info not found: " + provider + " / " + providerid)
}
return nil, provider, providerid
return provider, providerid, nil
}