add user management functionality with OTP verification and consent handling, DI introduced

This commit is contained in:
2025-08-10 10:38:49 +03:00
parent 6a9061a3de
commit 5d80a68b44
30 changed files with 828 additions and 528 deletions

View File

@ -3,26 +3,15 @@ package hydra_client
import (
"git.logidex.ru/fakz9/logidex-id/internal/config"
hydraApi "github.com/ory/hydra-client-go"
"sync"
)
var (
client *hydraApi.APIClient
initClient sync.Once
)
func InitClient() {
func NewHydraClient(appConfig config.Config) *hydraApi.APIClient {
cfg := hydraApi.NewConfiguration()
cfg.AddDefaultHeader("X-Secret", config.Cfg.Hydra.Password)
cfg.AddDefaultHeader("X-Secret", appConfig.Hydra.Password)
cfg.Servers = []hydraApi.ServerConfiguration{
{
URL: config.Cfg.Hydra.Host,
URL: appConfig.Hydra.Host,
},
}
client = hydraApi.NewAPIClient(cfg)
}
func GetClient() *hydraApi.APIClient {
initClient.Do(InitClient)
return client
return hydraApi.NewAPIClient(cfg)
}