<commit_before>package main

import (
	"github.com/mediocregopher/hyrax/server/auth"
	"github.com/mediocregopher/hyrax/server/config"
	"github.com/mediocregopher/hyrax/server/dist"
	"github.com/mediocregopher/hyrax/server/net"
	"github.com/mediocregopher/hyrax/server/storage-router/storage"
	"github.com/mediocregopher/hyrax/translate"
	"strings"
	"log"
)

func main() {
	err := config.Load()
	if err != nil {
		log.Fatal(err)
	}

	if config.FirstNode {
		secrets := config.InitSecrets
		log.Println("This is the first node, loading up the secrets")
		for _, secret := range secrets {
			log.Println("Loading secret:", string(secret))
			auth.AddGlobalSecret(secret)
		}
	}

	storageAddr := config.StorageAddr
	log.Println("Connecting to storage unit at", storageAddr)
	err = storage.AddUnit(storageAddr, "tcp", storageAddr)
	if err != nil {
		log.Fatal(err)
	}

	meshListenAddr := config.MeshListenAddr
	meshAdvertiseAddr := config.MeshAdvertiseAddr
	log.Println("Creating mesh listener at", meshListenAddr)
	if err = dist.Init(meshListenAddr); err != nil {
		log.Fatal(err)
	} else if err = dist.AddNode(&meshAdvertiseAddr); err != nil {
		log.Fatal(err)
	}

	listens := config.ListenAddrs
	for i := range listens {
		log.Println("Listening for clients at", listens[i])
		go listenHandler(&listens[i])
	}

	select {}<commit_msg>fixed server not initiating with a bucket already filled<commit_after>package main

import (
	"github.com/mediocregopher/hyrax/server/auth"
	"github.com/mediocregopher/hyrax/server/config"
	"github.com/mediocregopher/hyrax/server/dist"
	"github.com/mediocregopher/hyrax/server/net"
	"github.com/mediocregopher/hyrax/server/storage-router"
	"github.com/mediocregopher/hyrax/translate"
	"strings"
	"log"
)

func main() {
	err := config.Load()
	if err != nil {
		log.Fatal(err)
	}

	if config.FirstNode {
		secrets := config.InitSecrets
		log.Println("This is the first node, loading up the secrets")
		for _, secret := range secrets {
			log.Println("Loading secret:", string(secret))
			auth.AddGlobalSecret(secret)
		}

		storageAddr := config.StorageAddr
		log.Println("Connecting to storage unit at", storageAddr)
		if err := router.SetBucket(0, "tcp", storageAddr); err != nil {
			log.Fatal(err)
		}
	}

	meshListenAddr := config.MeshListenAddr
	meshAdvertiseAddr := config.MeshAdvertiseAddr
	log.Println("Creating mesh listener at", meshListenAddr)
	if err = dist.Init(meshListenAddr); err != nil {
		log.Fatal(err)
	} else if err = dist.AddNode(&meshAdvertiseAddr); err != nil {
		log.Fatal(err)
	}

	listens := config.ListenAddrs
	for i := range listens {
		log.Println("Listening for clients at", listens[i])
		go listenHandler(&listens[i])
	}

	select {}
{'fraction_non_alphanumeric': 0.13325909428359317, 'fraction_numerical': 0.0003711952487008166, 'mean_word_length': 4.545267489711934, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5073299', 'n_tokens_mistral': 1004, 'n_tokens_neox': 935, 'n_words': 192}