There are two ways, depending on your scenario:
If you are developing a web application for end users, just place it so that your API key is not disclosed. Thus, keeping it gitignored in a separate file, and only uploading it to your server should be fine (as long as there is no violation on your server). Any obfuscation will not add any practical benefit, it will simply give a false sense of security.
If you are developing an infrastructure / library for developers or a client application for end users, ask them to create their own API key.
schlamar
source share