Psalm 44:8 In God we boast all the day long, and praise thy name for ever.
Though being surrounded by enemies and in various dangers, David trusts in the Lord, so much so that he can even boast in the Lord all day and praise His name for ever. Bragging about self is sinful pride, but bragging about your God is right and good. Responding to need with praise is better than complaining. Boasting in God is not artificial or faking, but it is true and real. In fact, He is even bigger and better than we can imagine.
We are told not to boast pridefully in self, but we are told to boast in the cross. Galatians 6:14: “But far be it from me to boast, except in the cross of our Lord Jesus Christ.” We can and should brag about the great grace and salvation of God given to us in the cross. The love of God is the most powerful force in the universe. Brag about it and enlarge Him in your mind. God is really big. God is really good.