mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-01-04 19:29:49 -06:00
* Introduce TLS Settings for go-micro based grpc services and clients TLS for the services can be configure by setting the OCIS_MICRO_GRPC_TLS_ENABLED" "OCIS_MICRO_GRPC_TLS_CERTIFICATE" and "OCIS_MICRO_GRPC_TLS_KEY" enviroment variables. TLS for the clients can configured by setting the "OCIS_MICRO_GRPC_CLIENT_TLS_MODE" and "OCIS_MICRO_GRPC_CLIENT_TLS_CACERT" variables. By default TLS is disabled. Co-authored-by: Martin <github@diemattels.at> * Unify TLS configuration for all grpc services All grpc service (whether they're based on reva) or go-micro use the same set of config vars now. TLS for the services can be configure by setting the OCIS_GRPC_TLS_ENABLED, OCIS_GRPC_TLS_CERTIFICATE and OCIS_GRPC_TLS_KEY enviroment variables. TLS for the clients can configured by setting the OCIS_GRPC_CLIENT_TLS_MODE and OCIS_MICRO_GRPC_CLIENT_TLS_CACERT variables. There are no individual per service config vars currently. If really needed, per service tls configurations can be specified via config file. Co-authored-by: Martin <github@diemattels.at> Co-authored-by: Martin <github@diemattels.at>
29 lines
532 B
Go
29 lines
532 B
Go
package shared
|
|
|
|
import "github.com/cs3org/reva/v2/pkg/rgrpc/todo/pool"
|
|
|
|
var defaultRevaConfig = Reva{
|
|
Address: "127.0.0.1:9142",
|
|
}
|
|
|
|
func DefaultRevaConfig() *Reva {
|
|
// copy
|
|
ret := defaultRevaConfig
|
|
return &ret
|
|
}
|
|
|
|
func (r *Reva) GetRevaOptions() []pool.Option {
|
|
tm, _ := pool.StringToTLSMode(r.TLS.Mode)
|
|
opts := []pool.Option{
|
|
pool.WithTLSMode(tm),
|
|
}
|
|
return opts
|
|
}
|
|
|
|
func (r *Reva) GetGRPCClientConfig() map[string]interface{} {
|
|
return map[string]interface{}{
|
|
"tls_mode": r.TLS.Mode,
|
|
"tls_cacert": r.TLS.CACert,
|
|
}
|
|
}
|