示例#1
0
文件: server.go 项目: CPSSD/MDFS
func (st *StorageNode) setUnid(unid string) (err error) {

	st.conf.Unid = unid
	err = config.SetConfiguration(st.conf, utils.GetUserHome()+"/.mdfs/stnode/.stnode_conf.json")
	if err != nil {
		return err
	}
	return err
}
示例#2
0
文件: configure.go 项目: CPSSD/MDFS
func setup(path, port, host, mdport, mdhost, sample, fname string) error {

	// create the supplied file path
	err := os.MkdirAll(path, 0700)
	if err != nil {
		return err
	}

	// get the sample configuration file from the repo
	conf := config.ParseConfiguration(sample + fname)
	conf.Path = path // change the path variable
	conf.Port = port // change the port variable
	conf.Host = host
	conf.MdHost = mdhost
	conf.MdPort = mdport

	// encode the new object to a json file
	err = config.SetConfiguration(conf, path+"."+fname)
	return err
}
示例#3
0
// for testing setup
func main() {

	err := os.MkdirAll(utils.GetUserHome()+"/.mdfs/mdservice", 0700)
	if err != nil {
		panic(err)
	}
	err = os.MkdirAll(utils.GetUserHome()+"/.mdfs/mdservice/files/", 0700)
	if err != nil {
		panic(err)
	}

	conf := config.ParseConfiguration("./mdservice/config/mdservice_conf.json")
	conf.Path = utils.GetUserHome() + "/.mdfs/mdservice/"

	// save the new configuration to file
	err = config.SetConfiguration(conf, conf.Path+"/.mdservice_conf.json")
	if err != nil {
		panic(err)
	}
}