<commit_before>package infrastructure

import (
	bosherr "bosh/errors"
	boshsettings "bosh/settings"
	boshdir "bosh/settings/directories"
	boshsys "bosh/system"
	"encoding/json"
	"path/filepath"
)

type dummyInfrastructure struct {
	fs          boshsys.FileSystem
	dirProvider boshdir.DirectoriesProvider
}

func newDummyInfrastructure(fs boshsys.FileSystem, dirProvider boshdir.DirectoriesProvider) (inf dummyInfrastructure) {
	inf.fs = fs
	inf.dirProvider = dirProvider
	return
}

func (inf dummyInfrastructure) SetupSsh(delegate SshSetupDelegate, username string) (err error) {
	return
}

func (inf dummyInfrastructure) GetSettings() (settings boshsettings.Settings, err error) {
	settingsPath := filepath.Join(inf.dirProvider.BaseDir(), "bosh", "settings.json")
	contents, err := inf.fs.ReadFile(settingsPath)
	if err != nil {
		err = bosherr.WrapError(err, "Read settings file")
		return
	}

	jsonSettings := boshsettings.Settings{}
	err = json.Unmarshal([]byte(contents), &jsonSettings)
	if err != nil {
		err = bosherr.WrapError(err, "Unmarshal json settings")
		return
	}

	settings.AgentId = jsonSettings.AgentId
	settings.Blobstore = jsonSettings.Blobstore
	settings.Mbus = jsonSettings.Mbus

	return
}

func (inf dummyInfrastructure) SetupNetworking(delegate NetworkingDelegate, networks boshsettings.Networks) (err error) {
	return
}<commit_msg>dummy infrastructure fetches all settings from settings.json<commit_after>package infrastructure

import (
	bosherr "bosh/errors"
	boshsettings "bosh/settings"
	boshdir "bosh/settings/directories"
	boshsys "bosh/system"
	"encoding/json"
	"path/filepath"
)

type dummyInfrastructure struct {
	fs          boshsys.FileSystem
	dirProvider boshdir.DirectoriesProvider
}

func newDummyInfrastructure(fs boshsys.FileSystem, dirProvider boshdir.DirectoriesProvider) (inf dummyInfrastructure) {
	inf.fs = fs
	inf.dirProvider = dirProvider
	return
}

func (inf dummyInfrastructure) SetupSsh(delegate SshSetupDelegate, username string) (err error) {
	return
}

func (inf dummyInfrastructure) GetSettings() (settings boshsettings.Settings, err error) {
	settingsPath := filepath.Join(inf.dirProvider.BaseDir(), "bosh", "settings.json")
	contents, err := inf.fs.ReadFile(settingsPath)
	if err != nil {
		err = bosherr.WrapError(err, "Read settings file")
		return
	}

	err = json.Unmarshal([]byte(contents), &settings)
	if err != nil {
		err = bosherr.WrapError(err, "Unmarshal json settings")
		return
	}

	return
}

func (inf dummyInfrastructure) SetupNetworking(delegate NetworkingDelegate, networks boshsettings.Networks) (err error) {
	return
}
{'fraction_non_alphanumeric': 0.10215882806476484, 'fraction_numerical': 0.0, 'mean_word_length': 5.5201005025125625, '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': '6533098', 'n_tokens_mistral': 841, 'n_tokens_neox': 818, 'n_words': 192}