With solid wire being very brittle and prone to breaking after a few extreme bends, I agree a strain relief is necessary if this is intended to function as mobile switch at the end of a wire.
Depending on your needs for cosmetic appearance, I would suggest something that is firm but not as hard as epoxy. White Polyurethane is used in power supplies to bond heavy parts to the board but this is a special item.
My favorite polyurethane adhesive is something like this. Allow a few days to cure.
[![enter image description here][1]][1]
The former volatile sub-floor adhesives were much faster drying but now obsolete. [1]: https://i.sstatic.net/GypEf.jpg