fix: app port and check subscribe_plan_id

This commit is contained in:
ericprd 2025-02-26 22:50:13 +08:00
parent 0100134527
commit 46472d01fe
4 changed files with 11 additions and 8 deletions

View File

@ -20,4 +20,7 @@ func InitEnv() {
DB_PASSWORD = utils.GetOrDefault("DB_PASSWORD", "")
DB_NAME = utils.GetOrDefault("DB_NAME", "")
DB_PORT = utils.GetOrDefault("DB_PORT", "")
APP_PORT = utils.GetOrDefault("APP_PORT", 3000)
GRACEFULL_TIMEOUT = utils.GetOrDefault("GRACEFULL_TIMEOUT", 10)
}

View File

@ -22,7 +22,7 @@ func Router(apiRouter chi.Router) {
defer stop()
svr := &http.Server{
Addr: fmt.Sprintf(":%d", APP_PORT),
Addr: fmt.Sprintf(":%d", config.APP_PORT),
Handler: mainRouter,
}

View File

@ -1,4 +0,0 @@
package pkgconfig
const APP_PORT = 3000
const GRACEFULL_TIMEOUT = 20

View File

@ -15,9 +15,13 @@ func (a *AuthSvc) RegisterUser(spec authdomain.RegisterUserReq) (string, error)
return "", errors.New("this email address is already in use")
}
subsId, err := a.subsRepo.Create(spec.SubscribePlanID)
if err != nil {
return "", nil
var subsId string
if spec.SubscribePlanID != "" {
subsId, err = a.subsRepo.Create(spec.SubscribePlanID)
if err != nil {
return "", nil
}
}
hashedPwd, err := HashPassword(spec.Password)