mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-10-26 21:22:16 +08:00
chore: config
This commit is contained in:
parent
15ef276caa
commit
6d60997105
@ -1,12 +1,11 @@
|
|||||||
package api
|
package api
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"net/http"
|
"encoding/json"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/openimsdk/open-im-server/v3/pkg/common/config"
|
"github.com/openimsdk/open-im-server/v3/pkg/common/config"
|
||||||
"github.com/openimsdk/tools/apiresp"
|
"github.com/openimsdk/tools/apiresp"
|
||||||
"gopkg.in/yaml.v3"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type ConfigManager struct {
|
type ConfigManager struct {
|
||||||
@ -20,10 +19,10 @@ func NewConfigManager(api *config.API) *ConfigManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (cm *ConfigManager) LoadApiConfig(c *gin.Context) {
|
func (cm *ConfigManager) LoadApiConfig(c *gin.Context) {
|
||||||
b, err := yaml.Marshal(cm.apiConfig)
|
b, err := json.Marshal(cm.apiConfig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
apiresp.GinError(c, err) // args option error
|
apiresp.GinError(c, err) // args option error
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
c.Data(http.StatusOK, "text/yaml; charset=utf-8", b)
|
apiresp.GinSuccess(c, string(b))
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user