tsk-21: Disable registration (#27)
Closes #21 Reviewed-on: phoenix/textsender-auth#27 Co-authored-by: phoenix <kundeng00@pm.me> Co-committed-by: phoenix <kundeng00@pm.me>
This commit is contained in:
@@ -1,9 +1,40 @@
|
||||
package handler
|
||||
|
||||
import (
|
||||
"git.kundeng.us/phoenix/textsender-models/pkg/user"
|
||||
"log"
|
||||
"os"
|
||||
"path"
|
||||
|
||||
"git.kundeng.us/phoenix/textsender-models/tx0/user"
|
||||
"github.com/joho/godotenv"
|
||||
|
||||
"git.kundeng.us/phoenix/textsender-auth/internal/config"
|
||||
)
|
||||
|
||||
func GetTestUser() user.User {
|
||||
return user.User{Username: "ghost", PhoneNumber: "+1234567890", Password: "dfgdffddfd"}
|
||||
}
|
||||
|
||||
func GetConfig() *config.Config {
|
||||
err := godotenv.Load()
|
||||
if err != nil {
|
||||
cwd, _ := os.Getwd()
|
||||
envPath := path.Join(cwd, "../..", ".env")
|
||||
if err = godotenv.Load(envPath); err != nil {
|
||||
prevPath := path.Join(envPath, "../..", ".env")
|
||||
if err = godotenv.Load(prevPath); err != nil {
|
||||
log.Fatal("Error loading .env file")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unpackedConnString := config.UnpackDBConnString()
|
||||
dbConnString := unpackedConnString.Parse()
|
||||
|
||||
return &config.Config{
|
||||
DBConnString: dbConnString,
|
||||
ServerPort: config.Port,
|
||||
ResetDB: false,
|
||||
EnableRegistration: config.CheckRegistration(),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user