databag/net/server/internal/api_getNodeConfig.go
2022-03-10 21:26:17 -08:00

25 lines
568 B
Go

package databag
import (
"net/http"
)
func GetNodeConfig(w http.ResponseWriter, r *http.Request) {
// validate login
if err := AdminLogin(r); err != nil {
ErrResponse(w, http.StatusUnauthorized, err)
return
}
// get node config fields
var config NodeConfig;
config.Domain = getStrConfigValue(CONFIG_DOMAIN, "");
config.AccountLimit = getNumConfigValue(CONFIG_ACCOUNTLIMIT, 16);
config.OpenAccess = getBoolConfigValue(CONFIG_OPENACCESS, true);
config.AccountStorage = getNumConfigValue(CONFIG_STORAGE, 0);
WriteResponse(w, config);
}