|
|
|
@ -7,11 +7,16 @@ import ( |
|
|
|
|
"net" |
|
|
|
|
"strconv" |
|
|
|
|
"sync" |
|
|
|
|
"test3k/authDB/internal/config" |
|
|
|
|
kafka "test3k/authDB/internal/transport/kafka" |
|
|
|
|
api "test3k/authDB/pkg/api" |
|
|
|
|
"time" |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
const ( |
|
|
|
|
topicRegistrations string = "registrations" // Топик для регистраций
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
type user struct { |
|
|
|
|
ID int32 |
|
|
|
|
Code string |
|
|
|
@ -29,11 +34,11 @@ type AuthDBServer struct { |
|
|
|
|
id int32 |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func NewServer() *AuthDBServer { |
|
|
|
|
func NewServer(config *config.Config) *AuthDBServer { |
|
|
|
|
return &AuthDBServer{ |
|
|
|
|
mu: sync.Mutex{}, |
|
|
|
|
users: make(map[string]*user), |
|
|
|
|
kafkaWriter: kafka.NewWriter("registrations", net.JoinHostPort("localhost", "9094")), |
|
|
|
|
kafkaWriter: kafka.NewWriter(topicRegistrations, net.JoinHostPort(config.Kafka.Host, strconv.Itoa(config.Kafka.Port))), |
|
|
|
|
id: 0, |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|