Files
Ralf Haferkamp 7b5c59e827 feat(reva): Pass the multi-tenancy flag to reva services
This allows to pass the multi-tenant enablement flag as a shared config
option to the reva service. This needs to be done for all reva services
since it ends up in a global variable in reva that is only initialized
once, by the service that is the first to parse its config.
See https://github.com/opencloud-eu/opencloud/issues/1563 for details.
2025-10-06 11:21:57 +02:00

55 lines
1.7 KiB
Go

package revaconfig
import (
"github.com/opencloud-eu/opencloud/services/auth-service/pkg/config"
)
// AuthMachineConfigFromStruct will adapt an OpenCloud config struct into a reva mapstructure to start a reva service.
func AuthMachineConfigFromStruct(cfg *config.Config) map[string]interface{} {
return map[string]interface{}{
"core": map[string]interface{}{
"tracing_enabled": cfg.Tracing.Enabled,
"tracing_exporter": cfg.Tracing.Type,
"tracing_endpoint": cfg.Tracing.Endpoint,
"tracing_collector": cfg.Tracing.Collector,
"tracing_service_name": cfg.Service.Name,
},
"shared": map[string]interface{}{
"jwt_secret": cfg.TokenManager.JWTSecret,
"gatewaysvc": cfg.Reva.Address,
"grpc_client_options": cfg.Reva.GetGRPCClientConfig(),
"multi_tenant_enabled": cfg.Commons.MultiTenantEnabled,
},
"grpc": map[string]interface{}{
"network": cfg.GRPC.Protocol,
"address": cfg.GRPC.Addr,
"tls_settings": map[string]interface{}{
"enabled": cfg.GRPC.TLS.Enabled,
"certificate": cfg.GRPC.TLS.Cert,
"key": cfg.GRPC.TLS.Key,
},
"services": map[string]interface{}{
"authprovider": map[string]interface{}{
"auth_manager": "serviceaccounts",
"auth_managers": map[string]interface{}{
"serviceaccounts": map[string]interface{}{
"service_accounts": []map[string]interface{}{
{
"id": cfg.ServiceAccount.ServiceAccountID,
"secret": cfg.ServiceAccount.ServiceAccountSecret,
},
},
},
},
},
},
"interceptors": map[string]interface{}{
"prometheus": map[string]interface{}{
"namespace": "opencloud",
"subsystem": "auth_service",
},
},
},
}
}