Replace secret key placeholder at build time


Answer: 1

24 hours ago

I'm developing an Ubuntu touch app in QML, and would like to keep an API key reasonably secret (at least I don't want to have to commit it into the VCS). I see that you can define environment variables in Projects -> Build & Run -> Build Environment, so my question is, how can I add a placeholder value in my QML that is then replaced by an environment variable at build time? Or is there a better way to do it?

Answer: 2

9 hours ago

The solution I came up with was to keep my secret in a special file. To my public repository, I committed only a placeholder, but I have the actual secret on my machine. In the build process, I read the secrets into build variables. These in turn are referenced in the relevant locations in my configuration files.

I don't know that this is the best solution, but it's worked pretty well for me. The downside is that the secrets file always shows up as modified in my VCS, but I've learned to ignore that.

Added by: Emelia Oberbrunner

Popular Search

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 1 2 3 4 5 6 7 8 9