I have mine on a 10 foot fence top-rail attached to my wood fence 4x4 and originally did it your way, but found that using pipe hanger brackets worked better. There’s about the same cost.
https://www.lowes.com/pd/AMERICAN-VALVE-1-in-to-1-in-dia-Galvanized-Clevis-Hanger/3223499 is one variant. I don’t recall which size I bought so you’ll want to be careful there re: size.
If you want me to take a photo of my setup IM me and I’ll do it this weekend sometime.