|
|
@ -3,10 +3,10 @@ package main |
|
|
|
import ( |
|
|
|
"flag" |
|
|
|
"fmt" |
|
|
|
"log" |
|
|
|
"net" |
|
|
|
|
|
|
|
"git.chrishayward.xyz/x/users/proto" |
|
|
|
"git.chrishayward.xyz/x/users/server" |
|
|
|
"github.com/google/uuid" |
|
|
|
"google.golang.org/grpc" |
|
|
|
) |
|
|
@ -23,17 +23,18 @@ func main() { |
|
|
|
|
|
|
|
// If the secret has not been set print it to the console.
|
|
|
|
if *secret == secretDefault { |
|
|
|
fmt.Printf("SECRET=%s", secretDefault) |
|
|
|
fmt.Printf("SECRET=%s\n", secretDefault) |
|
|
|
} |
|
|
|
|
|
|
|
// Create the network listener.
|
|
|
|
lis, err := net.Listen("tcp", fmt.Sprintf(":%d", *port)) |
|
|
|
if err != nil { |
|
|
|
log.Fatalf("Failed to listen: %v", err) |
|
|
|
fmt.Printf("Failed to listen: %v", err) |
|
|
|
} |
|
|
|
|
|
|
|
// Start listening for requests.
|
|
|
|
srv := grpc.NewServer() |
|
|
|
proto.RegisterUsersServer(srv, newUsersServer(secret)) |
|
|
|
proto.RegisterUsersServer(srv, server.NewUsersServer(secret)) |
|
|
|
fmt.Printf("Listening on :%d", *port) |
|
|
|
srv.Serve(lis) |
|
|
|
} |