|
|
@ -173,11 +173,21 @@ func MergeServiceConfig(defaults *structs.ServiceConfigResponse, service *struct
|
|
|
|
us.MeshGateway.Mode = remoteCfg.MeshGateway.Mode
|
|
|
|
us.MeshGateway.Mode = remoteCfg.MeshGateway.Mode
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
preMergeProtocol, found := us.Config["protocol"]
|
|
|
|
// Merge in everything else that is read from the map
|
|
|
|
// Merge in everything else that is read from the map
|
|
|
|
if err := mergo.Merge(&us.Config, remoteCfg.Config); err != nil {
|
|
|
|
if err := mergo.Merge(&us.Config, remoteCfg.Config); err != nil {
|
|
|
|
return nil, err
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Reset the protocol to its pre-merged version for peering upstreams.
|
|
|
|
|
|
|
|
if us.DestinationPeer != "" {
|
|
|
|
|
|
|
|
if found {
|
|
|
|
|
|
|
|
us.Config["protocol"] = preMergeProtocol
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
delete(us.Config, "protocol")
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Delete the mesh gateway key from opaque config since this is the value that was resolved from
|
|
|
|
// Delete the mesh gateway key from opaque config since this is the value that was resolved from
|
|
|
|
// the servers and NOT the final merged value for this upstream.
|
|
|
|
// the servers and NOT the final merged value for this upstream.
|
|
|
|
// Note that we use the "mesh_gateway" key and not other variants like "MeshGateway" because
|
|
|
|
// Note that we use the "mesh_gateway" key and not other variants like "MeshGateway" because
|
|
|
|