mirror of
https://github.com/CPunch/gopenfusion.git
synced 2024-11-10 02:20:05 +00:00
unknown
d7445e0f0f
- loginMetadata is passed to shards through redis now - shards announce they're alive via redis.AnnounceShard() which just populates a hashset keyed 'shards' - login servers grab the 'shards' hashset and randomly picks a shard to pass the player to (for now) - ./service shard && ./service login - Many new environment variables, check config/config.go for more info. or for a tl;dr just read the Dockerfile for the required ones - Shard and login services now run in different processes ! (and containers?? wooaaah)
43 lines
880 B
Go
43 lines
880 B
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
"flag"
|
|
"log"
|
|
|
|
"github.com/CPunch/gopenfusion/config"
|
|
"github.com/CPunch/gopenfusion/login"
|
|
"github.com/google/subcommands"
|
|
)
|
|
|
|
type loginCommand struct {
|
|
port int
|
|
}
|
|
|
|
func (s *loginCommand) Name() string {
|
|
return "login"
|
|
}
|
|
|
|
func (s *loginCommand) Synopsis() string {
|
|
return "Starts login service"
|
|
}
|
|
|
|
func (s *loginCommand) Usage() string {
|
|
return s.Name() + " - " + s.Synopsis() + ":\n"
|
|
}
|
|
|
|
func (s *loginCommand) SetFlags(f *flag.FlagSet) {
|
|
f.IntVar(&s.port, "port", config.LOGIN_PORT, "Hosts the service on this port")
|
|
}
|
|
|
|
func (s *loginCommand) Execute(ctx context.Context, f *flag.FlagSet, _ ...interface{}) subcommands.ExitStatus {
|
|
loginServer, err := login.NewLoginServer(dbHndlr, redisHndlr, s.port)
|
|
if err != nil {
|
|
log.Panicf("failed to create shard server: %v", err)
|
|
}
|
|
|
|
loginServer.Start()
|
|
|
|
return subcommands.ExitSuccess
|
|
}
|