當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。