<commit_before>package main

import (
	"net/http"

	"github.com/spring1843/chat-server/src/chat"
	"github.com/spring1843/chat-server/src/config"
	"github.com/spring1843/chat-server/src/drivers/rest"
	"github.com/spring1843/chat-server/src/drivers/telnet"
	"github.com/spring1843/chat-server/src/drivers/websocket"
	"github.com/spring1843/chat-server/src/shared/logs"
)

const staticWebContentDir = "../bin/web"

func bootstrap(config config.Config) {
	chatServer := chat.NewServer()
	chatServer.Listen()
	logs.Info("Chat Server started")

	logs.FatalIfErrf(startTelnet(config, chatServer), "Could not start telnet server.")

	restHandler := rest.GetHandler(chatServer)
	websocket.SetWebSocket(chatServer)
	fs := http.FileServer(http.Dir(staticWebContentDir))

	http.Handle("/api/", restHandler)
	http.HandleFunc("/ws", websocket.Handler)
	http.Handle("/", fs)

	go func() {
		logs.Infof("Serving static files, Rest, WebSocket on http:/%s/", config.WebAddress)
		logs.FatalIfErrf(http.ListenAndServeTLS(config.WebAddress, "tls.crt", "tls.key", nil), "Could not start Rest server.")
	}()
}

func startTelnet(config config.Config, chatServer *chat.Server) error {
	err := telnet.Start(chatServer, config)
	if err != nil {
		return err

	}
	logs.Info("Telnet server started")
	return nil
}<commit_msg>If config address is empty for telnet or web, do not serve<commit_after>package main

import (
	"net/http"

	"github.com/spring1843/chat-server/src/chat"
	"github.com/spring1843/chat-server/src/config"
	"github.com/spring1843/chat-server/src/drivers/rest"
	"github.com/spring1843/chat-server/src/drivers/telnet"
	"github.com/spring1843/chat-server/src/drivers/websocket"
	"github.com/spring1843/chat-server/src/shared/logs"
)

const staticWebContentDir = "../bin/web"

func bootstrap(config config.Config) {
	chatServer := chat.NewServer()
	chatServer.Listen()
	logs.Info("Chat Server started")

	if config.TelnetAddress != "" {
		logs.FatalIfErrf(startTelnet(config, chatServer), "Could not start telnet server.")
	} else {
		logs.Warnf("TelnetAddress is empty, not running Telnet Driver")
	}

	if config.WebAddress != "" {
		logs.FatalIfErrf(startWeb(config, chatServer), "Could not start web server.")
	} else {
		logs.Warnf("WebAddress is empty, not running Web Drivers")
	}
}

func startTelnet(config config.Config, chatServer *chat.Server) error {
	err := telnet.Start(chatServer, config)
	if err != nil {
		return err

	}
	logs.Info("Telnet server started")
	return nil
}

func startWeb(config config.Config, chatServer *chat.Server) error {
	restHandler := rest.GetHandler(chatServer)
	websocket.SetWebSocket(chatServer)
	fs := http.FileServer(http.Dir(staticWebContentDir))

	http.Handle("/api/", restHandler)
	http.HandleFunc("/ws", websocket.Handler)
	http.Handle("/", fs)

	go func() {
		logs.Infof("Serving static files, Rest, WebSocket on http:/%s/", config.WebAddress)
		logs.FatalIfErrf(http.ListenAndServeTLS(config.WebAddress, "tls.crt", "tls.key", nil), "Could not start Rest server.")
	}()
	return nil
}
{'fraction_non_alphanumeric': 0.14602649006622517, 'fraction_numerical': 0.015894039735099338, 'mean_word_length': 4.994047619047619, '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': '3050057', 'n_tokens_mistral': 1118, 'n_tokens_neox': 1044, 'n_words': 202}