当前位置: 首页>>代码示例>>Golang>>正文


Golang config.NewCGRConfigFromFolder函数代码示例

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


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


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