<commit_before>package server

import (
	"fmt"
	"github.com/ActiveState/log"
	"sync"
)

type ClusterConfig struct {
	MbusIp   string `json:"mbusip"`
	Endpoint string `json:"endpoint"`
}

func (c *ClusterConfig) GetNatsUri() string {
	// HACK: Ideally we should be reading NatsUri from
	// cloud_controller config (mbus). we take a shortcut here in
	// order to not have to create a separate ConfDis instance for
	// cloud_controller config (and having to watch it). This will
	// have to change if we switch to clustered version of NATS.
	return fmt.Sprintf("nats://%s:4222/", c.MbusIp)
}

var clusterConfig *Config

func GetClusterConfig() *ClusterConfig {
	once.Do(createClusterConfig)
	return clusterConfig.Config.(*ClusterConfig)
}

var once sync.Once

func createClusterConfig() {
	var err error
	clusterConfig, err = NewConfig("cluster", ClusterConfig{})
	if err != nil {
		log.Fatal(err)
	}
}

// IsMicro returns true if the cluster is configured as a micro cloud.
func (c *ClusterConfig) IsMicro() bool {
	return c.MbusIp == "127.0.0.1"
}
<commit_msg>use the new confdis API (race fix)<commit_after>package server

import (
	"fmt"
	"github.com/ActiveState/log"
	"sync"
)

type ClusterConfig struct {
	MbusIp   string `json:"mbusip"`
	Endpoint string `json:"endpoint"`
}

func (c *ClusterConfig) GetNatsUri() string {
	// HACK: Ideally we should be reading NatsUri from
	// cloud_controller config (mbus). we take a shortcut here in
	// order to not have to create a separate ConfDis instance for
	// cloud_controller config (and having to watch it). This will
	// have to change if we switch to clustered version of NATS.
	return fmt.Sprintf("nats://%s:4222/", c.MbusIp)
}

var clusterConfig *Config

func GetClusterConfig() *ClusterConfig {
	once.Do(createClusterConfig)
	return clusterConfig.GetConfig().(*ClusterConfig)
}

var once sync.Once

func createClusterConfig() {
	var err error
	clusterConfig, err = NewConfig("cluster", ClusterConfig{})
	if err != nil {
		log.Fatal(err)
	}
}

// IsMicro returns true if the cluster is configured as a micro cloud.
func (c *ClusterConfig) IsMicro() bool {
	return c.MbusIp == "127.0.0.1"
}

{'fraction_non_alphanumeric': 0.11100746268656717, 'fraction_numerical': 0.009328358208955223, 'mean_word_length': 4.218978102189781, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '2177684', 'n_tokens_mistral': 716, 'n_tokens_neox': 685, 'n_words': 238}