Permalink
Browse files

Shorter default node ID.

Contemplating always requiring the user to suppy one, but this is at
least more usable.

Closes #111
  • Loading branch information...
dustin committed Oct 15, 2012
1 parent 8dcee2b commit b43a34abf26cde56fb0175ef278e38d667e4b29c
Showing with 5 additions and 1 deletion.
  1. +5 −1 registry.go
View
@@ -1,6 +1,7 @@
package main
import (
+ "encoding/hex"
"encoding/json"
"errors"
"flag"
@@ -92,7 +93,10 @@ func initServerId() error {
serverId = strings.TrimSpace(string(bytes))
} else {
if serverId == "" {
- serverId = time.Now().UTC().Format(time.RFC3339Nano)
+ h := getHash()
+ t := time.Now().UTC().Format(time.RFC3339Nano)
+ h.Write([]byte(t))
+ serverId = hex.EncodeToString(h.Sum(nil))[:8]
}
}
return err

0 comments on commit b43a34a

Please sign in to comment.