• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Golang config.NewCGRConfigFromFolder函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/cgrates/cgrates/config.NewCGRConfigFromFolder函数的典型用法代码示例。如果您正苦于以下问题:Golang NewCGRConfigFromFolder函数的具体用法?Golang NewCGRConfigFromFolder怎么用?Golang NewCGRConfigFromFolder使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了NewCGRConfigFromFolder函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: TestCdrsInitConfig

func TestCdrsInitConfig(t *testing.T) {
	var err error
	cdrsMasterCfgPath = path.Join(*dataDir, "conf", "samples", "cdrsreplicationmaster")
	if cdrsMasterCfg, err = config.NewCGRConfigFromFolder(cdrsMasterCfgPath); err != nil {
		t.Fatal("Got config error: ", err.Error())
	}
	cdrsSlaveCfgPath = path.Join(*dataDir, "conf", "samples", "cdrsreplicationslave")
	if cdrsSlaveCfg, err = config.NewCGRConfigFromFolder(cdrsSlaveCfgPath); err != nil {
		t.Fatal("Got config error: ", err.Error())
	}
}
开发者ID:cgrates,项目名称:cgrates,代码行数:11,代码来源:cdrs_replication_it_test.go


示例2: TestSMGRplcInitCfg

func TestSMGRplcInitCfg(t *testing.T) {

	smgRplcMasterCfgPath = path.Join(*dataDir, "conf", "samples", "smgreplcmaster")
	if smgRplcMasterCfg, err = config.NewCGRConfigFromFolder(smgRplcMasterCfgPath); err != nil {
		t.Fatal(err)
	}
	smgRplcMasterCfg.DataFolderPath = *dataDir // Share DataFolderPath through config towards StoreDb for Flush()
	config.SetCgrConfig(smgRplcMasterCfg)
	smgRplcSlaveCfgPath = path.Join(*dataDir, "conf", "samples", "smgreplcslave")
	if smgRplcSlaveCfg, err = config.NewCGRConfigFromFolder(smgRplcSlaveCfgPath); err != nil {
		t.Fatal(err)
	}
}
开发者ID:cgrates,项目名称:cgrates,代码行数:13,代码来源:smgreplc_it_test.go


示例3: TestRPCITLclInitCfg

func TestRPCITLclInitCfg(t *testing.T) {
	rpcITCfgPath1 = path.Join(*dataDir, "conf", "samples", "multiral1")
	rpcITCfgPath2 = path.Join(*dataDir, "conf", "samples", "multiral2")
	rpcITCfg1, err = config.NewCGRConfigFromFolder(rpcITCfgPath1)
	if err != nil {
		t.Error(err)
	}
	rpcITCfg2, err = config.NewCGRConfigFromFolder(rpcITCfgPath2)
	if err != nil {
		t.Error(err)
	}
	if err := engine.InitDataDb(rpcITCfg1); err != nil {
		t.Fatal(err)
	}
}
开发者ID:cgrates,项目名称:cgrates,代码行数:15,代码来源:rpcclient_it_test.go


示例4: TestMCDRCLoadConfig

func TestMCDRCLoadConfig(t *testing.T) {
	var err error
	cfgPath = path.Join(*dataDir, "conf", "samples", "multiplecdrc")
	if cfg, err = config.NewCGRConfigFromFolder(cfgPath); err != nil {
		t.Error(err)
	}
}
开发者ID:cgrates,项目名称:cgrates,代码行数:7,代码来源:multiplecdrc_it_test.go


示例5: TestCDRStatsitLoadConfig

func TestCDRStatsitLoadConfig(t *testing.T) {
	var err error
	cdrstCfgPath = path.Join(*dataDir, "conf", "samples", "cdrstats")
	if cdrstCfg, err = config.NewCGRConfigFromFolder(cfgPath); err != nil {
		t.Error(err)
	}
}
开发者ID:cgrates,项目名称:cgrates,代码行数:7,代码来源:cdrstatsv1_it_test.go


示例6: main

func main() {
	flag.Parse()
	var err error
	var cdrsMasterRpc *rpcclient.RpcClient
	var cdrsMasterCfgPath string
	var cdrsMasterCfg *config.CGRConfig
	cdrsMasterCfgPath = path.Join(*dataDir, "conf", "samples", "cdrsreplicationmaster")
	if cdrsMasterCfg, err = config.NewCGRConfigFromFolder(cdrsMasterCfgPath); err != nil {
		log.Fatal("Got config error: ", err.Error())
	}
	cdrsMasterRpc, err = rpcclient.NewRpcClient("tcp", cdrsMasterCfg.RPCJSONListen, 1, 1, time.Duration(1*time.Second), time.Duration(2*time.Second), "json", nil)
	if err != nil {
		log.Fatal("Could not connect to rater: ", err.Error())
	}
	cdrs := make([]*engine.CDR, 0)
	for i := 0; i < 10000; i++ {
		cdr := &engine.CDR{OriginID: fmt.Sprintf("httpjsonrpc_%d", i),
			ToR: utils.VOICE, OriginHost: "192.168.1.1", Source: "UNKNOWN", RequestType: utils.META_PSEUDOPREPAID,
			Direction: "*out", Tenant: "cgrates.org", Category: "call", Account: "1001", Subject: "1001", Destination: "1002",
			SetupTime: time.Date(2013, 12, 7, 8, 42, 24, 0, time.UTC), AnswerTime: time.Date(2013, 12, 7, 8, 42, 26, 0, time.UTC),
			Usage: time.Duration(10) * time.Second, ExtraFields: map[string]string{"field_extr1": "val_extr1", "fieldextr2": "valextr2"}}
		cdrs = append(cdrs, cdr)
	}
	var reply string
	for _, cdr := range cdrs {
		if err := cdrsMasterRpc.Call("CdrsV2.ProcessCdr", cdr, &reply); err != nil {
			log.Fatal("Unexpected error: ", err.Error())
		} else if reply != utils.OK {
			log.Fatal("Unexpected reply received: ", reply)
		}
	}
}
开发者ID:iwada,项目名称:cgrates,代码行数:32,代码来源:process_cdr.go


示例7: TestPartcsvITInitConfig

func TestPartcsvITInitConfig(t *testing.T) {
	var err error
	partpartcsvCfgPath = path.Join(*dataDir, "conf", "samples", "cdrc_partcsv")
	if partcsvCfg, err = config.NewCGRConfigFromFolder(partpartcsvCfgPath); err != nil {
		t.Fatal("Got config error: ", err.Error())
	}
}
开发者ID:cgrates,项目名称:cgrates,代码行数:7,代码来源:partialcsv_it_test.go


示例8: TestFlatstoreitInitCfg

func TestFlatstoreitInitCfg(t *testing.T) {
	var err error
	flatstoreCfgPath = path.Join(*dataDir, "conf", "samples", "cdrcflatstore")
	if flatstoreCfg, err = config.NewCGRConfigFromFolder(flatstoreCfgPath); err != nil {
		t.Fatal("Got config error: ", err.Error())
	}
}
开发者ID:cgrates,项目名称:cgrates,代码行数:7,代码来源:flatstore_it_test.go


示例9: TestXmlITInitConfig

func TestXmlITInitConfig(t *testing.T) {
	var err error
	xmlCfgPath = path.Join(*dataDir, "conf", "samples", "cdrcxml")
	if xmlCfg, err = config.NewCGRConfigFromFolder(xmlCfgPath); err != nil {
		t.Fatal("Got config error: ", err.Error())
	}
}
开发者ID:cgrates,项目名称:cgrates,代码行数:7,代码来源:xml_it_test.go


示例10: testV2CDRsInitConfig

func testV2CDRsInitConfig(t *testing.T) {
	var err error
	cdrsCfgPath = path.Join(*dataDir, "conf", "samples", cdrsConfDIR)
	if cdrsCfg, err = config.NewCGRConfigFromFolder(cdrsCfgPath); err != nil {
		t.Fatal("Got config error: ", err.Error())
	}
}
开发者ID:cgrates,项目名称:cgrates,代码行数:7,代码来源:cdrs_it_test.go


示例11: TestSTIInitCfg

func TestSTIInitCfg(t *testing.T) {
	// Init config first
	var err error
	stiCfg, err = config.NewCGRConfigFromFolder(*configDir)
	if err != nil {
		t.Error(err)
	}
}
开发者ID:cgrates,项目名称:cgrates,代码行数:8,代码来源:suretax_it_test.go


示例12: TestApierV2itLoadConfig

func TestApierV2itLoadConfig(t *testing.T) {
	if !*testIT {
		return
	}
	apierCfgPath = path.Join(*dataDir, "conf", "samples", "tutmysql")
	if apierCfg, err = config.NewCGRConfigFromFolder(tpCfgPath); err != nil {
		t.Error(err)
	}
}
开发者ID:rinor,项目名称:cgrates,代码行数:9,代码来源:apierv2_it_test.go


示例13: TestLoadConfigt

// Need it here and not in init since Travis has no possibility to load local file
func TestLoadConfigt(*testing.T) {
	if !*testLocal {
		return
	}
	cfgPath = path.Join(*dataDir, "conf", "samples", "apier")
	cfg, _ = config.NewCGRConfigFromFolder(cfgPath)
	if len(cfg.CdrcProfiles) > 0 {
		cdrcCfgs = cfg.CdrcProfiles["/var/log/cgrates/cdrc/in"]
	}
}
开发者ID:gale320,项目名称:cgrates,代码行数:11,代码来源:cdrc_local_test.go


示例14: TestV2CDRsPSQLInitConfig

func TestV2CDRsPSQLInitConfig(t *testing.T) {
	if !*testLocal {
		return
	}
	var err error
	cdrsPsqlCfgPath = path.Join(*dataDir, "conf", "samples", "cdrsv2psql")
	if cdrsPsqlCfg, err = config.NewCGRConfigFromFolder(cdrsPsqlCfgPath); err != nil {
		t.Fatal(err)
	}
}
开发者ID:iwada,项目名称:cgrates,代码行数:10,代码来源:cdrs_psql_local_test.go


示例15: TestTutOsipsCallsInitCfg

func TestTutOsipsCallsInitCfg(t *testing.T) {
	// Init config first
	var err error
	tutOsipsCallsCfg, err = config.NewCGRConfigFromFolder(path.Join(*dataDir, "tutorials", "osips_async", "cgrates", "etc", "cgrates"))
	if err != nil {
		t.Error(err)
	}
	tutOsipsCallsCfg.DataFolderPath = *dataDir // Share DataFolderPath through config towards StoreDb for Flush()
	config.SetCgrConfig(tutOsipsCallsCfg)
}
开发者ID:cgrates,项目名称:cgrates,代码行数:10,代码来源:tutorial_osips_calls_test.go


示例16: TestCsvITInitConfig

func TestCsvITInitConfig(t *testing.T) {
	if !*testIT {
		return
	}
	var err error
	csvCfgPath = path.Join(*dataDir, "conf", "samples", "cdrccsv")
	if csvCfg, err = config.NewCGRConfigFromFolder(csvCfgPath); err != nil {
		t.Fatal("Got config error: ", err.Error())
	}
}
开发者ID:eloycoto,项目名称:cgrates,代码行数:10,代码来源:csv_it_test.go


示例17: TestV2CdrsMongoInitConfig

func TestV2CdrsMongoInitConfig(t *testing.T) {
	if !*testLocal {
		return
	}
	var err error
	cdrsMongoCfgPath = path.Join(*dataDir, "conf", "samples", "cdrsv2mongo")
	if cdrsMongoCfg, err = config.NewCGRConfigFromFolder(cdrsMongoCfgPath); err != nil {
		t.Fatal("Got config error: ", err.Error())
	}
}
开发者ID:iwada,项目名称:cgrates,代码行数:10,代码来源:cdrs_mongo_local_test.go


示例18: TestFwvLclInitCfg

func TestFwvLclInitCfg(t *testing.T) {
	if !*testLocal {
		return
	}
	var err error
	fwvCfgPath = path.Join(*dataDir, "conf", "samples", "cdrcfwv")
	if fwvCfg, err = config.NewCGRConfigFromFolder(fwvCfgPath); err != nil {
		t.Fatal("Got config error: ", err.Error())
	}
}
开发者ID:iwada,项目名称:cgrates,代码行数:10,代码来源:fwv_local_test.go


示例19: TestTutSMGInitCfg

func TestTutSMGInitCfg(t *testing.T) {
	tutSMGCfgPath = path.Join(*dataDir, "conf", "samples", "smgeneric")
	// Init config first
	var err error
	tutSMGCfg, err = config.NewCGRConfigFromFolder(tutSMGCfgPath)
	if err != nil {
		t.Error(err)
	}
	tutSMGCfg.DataFolderPath = *dataDir // Share DataFolderPath through config towards StoreDb for Flush()
	config.SetCgrConfig(tutSMGCfg)
}
开发者ID:cgrates,项目名称:cgrates,代码行数:11,代码来源:tut_smgeneric_it_test.go


示例20: TestOnStorITMongoConnect

func TestOnStorITMongoConnect(t *testing.T) {
	cdrsMongoCfgPath := path.Join(*dataDir, "conf", "samples", "cdrsv2mongo")
	mgoITCfg, err := config.NewCGRConfigFromFolder(cdrsMongoCfgPath)
	if err != nil {
		t.Fatal(err)
	}
	if mgoITdb, err = NewMongoStorage(mgoITCfg.StorDBHost, mgoITCfg.StorDBPort, mgoITCfg.StorDBName, mgoITCfg.StorDBUser, mgoITCfg.StorDBPass,
		utils.StorDB, nil, mgoITCfg.CacheConfig, mgoITCfg.LoadHistorySize); err != nil {
		t.Fatal(err)
	}
}
开发者ID:cgrates,项目名称:cgrates,代码行数:11,代码来源:onstor_it_test.go



注:本文中的github.com/cgrates/cgrates/config.NewCGRConfigFromFolder函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang config.NewDefaultCGRConfig函数代码示例发布时间:2022-05-23
下一篇:
Golang config.CgrConfig函数代码示例发布时间:2022-05-23
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap