Commit 655f6c9d authored by chenweijian's avatar chenweijian

trtc config

parent 7a5a3089
...@@ -120,6 +120,12 @@ type AgoraConfig struct { ...@@ -120,6 +120,12 @@ type AgoraConfig struct {
CUSTOMER_SECRET string CUSTOMER_SECRET string
} }
//腾讯TRTC
type TRTCConfig struct {
APP_ID int
APP_CERTIFICATE string
}
//匹配的配置 //匹配的配置
type MatchConfig struct { type MatchConfig struct {
//一开始匹配的默认时长(单位:秒) //一开始匹配的默认时长(单位:秒)
...@@ -323,6 +329,7 @@ var rongyunData RongyunConfig ...@@ -323,6 +329,7 @@ var rongyunData RongyunConfig
var tencentyunData TencentyunConfig var tencentyunData TencentyunConfig
var emasData EmasConfig var emasData EmasConfig
var agora AgoraConfig var agora AgoraConfig
var trtc TRTCConfig
var matchData MatchConfig var matchData MatchConfig
var onlineData OnlineConfig var onlineData OnlineConfig
var sessionData SessionConfig var sessionData SessionConfig
...@@ -570,6 +577,10 @@ func GetUrlConfig() URLConfig { ...@@ -570,6 +577,10 @@ func GetUrlConfig() URLConfig {
return urlConfig return urlConfig
} }
func GetTRTCConfig() TRTCConfig {
return trtc
}
func init() { func init() {
str, _ := os.Getwd() str, _ := os.Getwd()
mylogrus.MyLog.Info(str) mylogrus.MyLog.Info(str)
...@@ -655,6 +666,10 @@ func init() { ...@@ -655,6 +666,10 @@ func init() {
mylogrus.MyLog.Fatal(err) mylogrus.MyLog.Fatal(err)
} }
if err := conf.Section("TRTC").MapTo(&trtc); err != nil {
mylogrus.MyLog.Fatal(err)
}
if err := conf.Section("MATCH").MapTo(&matchData); err != nil { if err := conf.Section("MATCH").MapTo(&matchData); err != nil {
mylogrus.MyLog.Fatal(err) mylogrus.MyLog.Fatal(err)
} }
......
...@@ -3,15 +3,14 @@ package trtc ...@@ -3,15 +3,14 @@ package trtc
import ( import (
"fmt" "fmt"
"git.hilo.cn/hilo-common/mylogrus" "git.hilo.cn/hilo-common/mylogrus"
"git.hilo.cn/hilo-common/resource/config"
) )
//创建群组的TRTC通道,token有效时长:一个星期 //创建群组的TRTC通道,token有效时长:一个星期
func CreateGroupTRTCUserSig(uid uint64) string { func CreateGroupTRTCUserSig(uid uint64, config config.TRTCConfig) string {
appId := 1400548270
appSecret := "321bd60f73096b059c7350f1cd97d51028850b34fa58c5c0d26bb4a19e783de8"
expireTimeInSeconds := 60 * 60 * 24 * 7 //一个星期 expireTimeInSeconds := 60 * 60 * 24 * 7 //一个星期
sig, err := GenUserSig(appId, appSecret, fmt.Sprintf("%d", uid), expireTimeInSeconds) sig, err := GenUserSig(config.APP_ID, config.APP_CERTIFICATE, fmt.Sprintf("%d", uid), expireTimeInSeconds)
if err != nil { if err != nil {
mylogrus.MyLog.Errorf("CreateGroupTRTCUserSig uid:%d, err:%v", uid, err) mylogrus.MyLog.Errorf("CreateGroupTRTCUserSig uid:%d, err:%v", uid, err)
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment