Files
QSfera/Server/services/app-provider/pkg/revaconfig/config.go
T
Курнат Андрей 2315f25754 Initial QSfera import
2026-06-07 10:20:04 +03:00

58 lines
2.1 KiB
Go

// Package revaconfig contains the config for the reva service
package revaconfig
import (
"github.com/qsfera/server/services/app-provider/pkg/config"
)
// AppProviderConfigFromStruct will adapt a КуСфера config struct into a reva mapstructure to start a reva service.
func AppProviderConfigFromStruct(cfg *config.Config) map[string]any {
rcfg := map[string]any{
"shared": map[string]any{
"jwt_secret": cfg.TokenManager.JWTSecret,
"gatewaysvc": cfg.Reva.Address,
"grpc_client_options": cfg.Reva.GetGRPCClientConfig(),
"multi_tenant_enabled": cfg.Commons.MultiTenantEnabled,
},
"grpc": map[string]any{
"network": cfg.GRPC.Protocol,
"address": cfg.GRPC.Addr,
"tls_settings": map[string]any{
"enabled": cfg.GRPC.TLS.Enabled,
"certificate": cfg.GRPC.TLS.Cert,
"key": cfg.GRPC.TLS.Key,
},
"services": map[string]any{
"appprovider": map[string]any{
"app_provider_url": cfg.ExternalAddr,
"driver": cfg.Driver,
"drivers": map[string]any{
"wopi": map[string]any{
"app_api_key": cfg.Drivers.WOPI.AppAPIKey,
"app_desktop_only": cfg.Drivers.WOPI.AppDesktopOnly,
"app_icon_uri": cfg.Drivers.WOPI.AppIconURI,
"app_int_url": cfg.Drivers.WOPI.AppInternalURL,
"app_name": cfg.Drivers.WOPI.AppName,
"app_url": cfg.Drivers.WOPI.AppURL,
"app_disable_chat": cfg.Drivers.WOPI.AppDisableChat,
"insecure_connections": cfg.Drivers.WOPI.Insecure,
"iop_secret": cfg.Drivers.WOPI.IopSecret,
"jwt_secret": cfg.TokenManager.JWTSecret,
"wopi_url": cfg.Drivers.WOPI.WopiURL,
"wopi_folder_url_base_url": cfg.Drivers.WOPI.WopiFolderURLBaseURL,
"wopi_folder_url_path_template": cfg.Drivers.WOPI.WopiFolderURLPathTemplate,
},
},
},
},
"interceptors": map[string]any{
"prometheus": map[string]any{
"namespace": "qsfera",
"subsystem": "app_provider",
},
},
},
}
return rcfg
}