databag/net/server/internal/api_getNodeConfig.go

35 lines
1.2 KiB
Go
Raw Normal View History

2022-01-15 21:45:37 +00:00
package databag
import (
"net/http"
)
2022-07-29 21:39:39 +00:00
//GetNodeConfig retreive current admin config
2022-01-15 21:45:37 +00:00
func GetNodeConfig(w http.ResponseWriter, r *http.Request) {
2022-07-22 19:28:14 +00:00
// validate login
if code, err := ParamAdminToken(r); err != nil {
ErrResponse(w, code, err)
return
}
2022-01-15 21:45:37 +00:00
2022-07-22 19:28:14 +00:00
// get node config fields
var config NodeConfig
config.Domain = getStrConfigValue(CNFDomain, "")
config.AccountStorage = getNumConfigValue(CNFStorage, 0)
config.AllowUnsealed = getBoolConfigValue(CNFAllowUnsealed, true)
config.EnableImage = getBoolConfigValue(CNFEnableImage, true)
config.EnableAudio = getBoolConfigValue(CNFEnableAudio, true)
config.EnableVideo = getBoolConfigValue(CNFEnableVideo, true)
config.KeyType = getStrConfigValue(CNFKeyType, APPRSA4096)
2022-11-10 04:54:44 +00:00
config.PushSupported = getBoolConfigValue(CNFPushSupported, true)
2023-04-13 07:39:14 +00:00
config.EnableIce = getBoolConfigValue(CNFEnableIce, false)
config.IceUrl = getStrConfigValue(CNFIceUrl, "")
config.IceUsername = getStrConfigValue(CNFIceUsername, "")
config.IcePassword = getStrConfigValue(CNFIcePassword, "")
2023-07-18 05:39:38 +00:00
config.EnableOpenAccess = getBoolConfigValue(CNFEnableOpenAccess, false);
config.OpenAccessLimit = getNumConfigValue(CNFOpenAccessLimit, 0);
2022-01-15 21:45:37 +00:00
2022-07-22 19:28:14 +00:00
WriteResponse(w, config)
2022-01-15 21:45:37 +00:00
}