add user management functionality with OTP verification and consent handling, DI introduced
This commit is contained in:
@ -1,9 +1,10 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"log"
|
||||
|
||||
"github.com/joho/godotenv"
|
||||
"github.com/spf13/viper"
|
||||
"log"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
@ -20,11 +21,16 @@ type Config struct {
|
||||
Host string
|
||||
Password string
|
||||
}
|
||||
DB struct {
|
||||
Host string
|
||||
Port int
|
||||
User string
|
||||
Password string
|
||||
Dbname string
|
||||
}
|
||||
}
|
||||
|
||||
var Cfg *Config
|
||||
|
||||
func Init() {
|
||||
func NewConfig() Config {
|
||||
err := godotenv.Load()
|
||||
if err != nil {
|
||||
log.Println("Error loading .env file")
|
||||
@ -48,5 +54,5 @@ func Init() {
|
||||
if err != nil {
|
||||
log.Fatalf("Unable to decode config into struct, %v", err)
|
||||
}
|
||||
Cfg = &config
|
||||
return config
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user