Browse Source

Depricate unused config options

master
Matthew Faltys 5 years ago
parent
commit
bded0fe536
  1. 1
      config.gcfg
  2. 1
      deps/server_config.gcfg
  3. 14
      nethack-launcher.go

1
config.gcfg

@ -6,7 +6,6 @@
userdir = "savedata/dgldir/userdata"
hackdir = "savedata/hack"
nhdatlocation = "/usr/lib/games/nethack/nhdat"
recordfilelocation = "record"
reclistlocation = "reclist"
bootstrapdelay = 1

1
deps/server_config.gcfg vendored

@ -6,7 +6,6 @@
userdir = "savedata/dgldir/userdata"
hackdir = "/hack"
nhdatlocation = "/usr/lib/games/nethack/nhdat"
recordfilelocation = "/hack/record"
reclistlocation = "/bin/reclist"
bootstrapdelay = 1

14
nethack-launcher.go

@ -27,7 +27,6 @@ type Config struct {
UserDir string // TODO: depricate this
HackDir string
NhdatLocation string
RecordFileLocation string
ReclistLocation string
BootstrapDelay time.Duration
}
@ -104,8 +103,8 @@ func initRedisConnection() (*redis.Client, error) {
func checkFiles() {
// make sure record file exists
if _, err := os.Stat(config.NethackLauncher.RecordFileLocation); os.IsNotExist(err) {
glogger.Info.Printf("record file not found in %s\n", config.NethackLauncher.RecordFileLocation)
if _, err := os.Stat(fmt.Sprintf("%s/record", config.NethackLauncher.HackDir)); os.IsNotExist(err) {
glogger.Info.Printf("record file not found in %s/record\n", config.NethackLauncher.HackDir)
fmt.Printf("%s\n", err)
os.Exit(1)
}
@ -200,6 +199,13 @@ func printUserScreen(redisClient *redis.Client, username string) string {
printProgressScreen(redisClient)
case "p":
// TODO save to inprogress
// SADD user to an inprogress redis set
// SET inprogress:user and expire it to 10 seconds
// start goroutine that keeps upping expire time every 8 or so seconds
// when goroutine exists, the key will be allowed to expire
// have a janitor that watches inprogress set
// janitor looks at every user in 'inprogress' and checks if the key remains
// if the key is gone, janitor kills the user from redis set
// restart display
nhCommand := fmt.Sprintf("nethack -d %s -u %s\n", config.NethackLauncher.HackDir, username)
ttyrecPath := fmt.Sprintf("%s/user/%s/ttyrec/yeet.ttyrec", config.NethackLauncher.HackDir, username)
@ -482,7 +488,7 @@ func gethighscore(w http.ResponseWriter, r *http.Request) {
// run script
output, err := exec.Command(config.NethackLauncher.ReclistLocation,
"-f",
config.NethackLauncher.RecordFileLocation).CombinedOutput()
fmt.Sprintf("%s/record", config.NethackLauncher.HackDir)).CombinedOutput()
if err != nil {
fmt.Printf("%s\n", err)
}

Loading…
Cancel
Save