添加配置写入redis

This commit is contained in:
lijun 2025-01-14 15:22:34 +08:00
parent f3e86af1b5
commit f74a401a81
1 changed files with 4 additions and 0 deletions

View File

@ -1,6 +1,7 @@
package proto package proto
import ( import (
"VideoStream/worker"
"encoding/json" "encoding/json"
"fmt" "fmt"
"os" "os"
@ -74,6 +75,9 @@ func ReadConfig(path string) error {
Config.SERVER_PORT = "5002" // 默认端口 Config.SERVER_PORT = "5002" // 默认端口
} }
} }
//将配置写入redis
json_data, err := json.Marshal(Config)
worker.SetRedis("vp_stream_config", string(json_data))
SigningKey = []byte(Config.TOKEN_SECRET) SigningKey = []byte(Config.TOKEN_SECRET)
if Config.TOKEN_SECRET == "" { if Config.TOKEN_SECRET == "" {
err = fmt.Errorf("token secret is empty") err = fmt.Errorf("token secret is empty")