asuc-octo / berkeley-mobile-android

The danker-than-iOS Berkeley Mobile app [Outdated]
Other
10 stars 3 forks source link

Use secret_dev.xml, secret_deploy.xml, and secret_template.xml instead of secret.xml. #147

Closed eliwu64 closed 4 years ago

eliwu64 commented 4 years ago

Fixes the problem where gitignore doesn't work with secret.xml.

Gitignore only works on files that are not tracked by git, and all files in our repo are tracked by git by definition. Even though we listed secret.xml in .gitignore, it doesn't work because secret.xml is still tracked by git since it's part of our repo. So if secret.xml were changed, it would still be picked up by git even though we listed it in .gitignore. If we told git to untrack the file in order for .gitignore to work for secret.xml, then the file will be removed from the repo permanently, which is not what we want either.

Instead, local developers would need to create a new file that is not part of our repo. So in our repo let's rename secret.xml to secret_template.xml and use it as a template. Developers then make a copy of the template file, name the copy secret_dev.xml, and insert the API key in that new file. The original template file will remain unchanged and tracked by git, and the new file contains the API key and is actually being used by the app. Since secret_dev.xml is listed under .gitignore, the new file with the API key won't get tracked or pushed.

Bitrise then replaces references to the key string in seret_dev.xml with the string in secret_deploy.xml, and for deployment it will replace the key string in secret_deploy.xml with the actual API key.

It's kind of hacky but this should fix this problem. The only thing developers need to do is create a copy of the template file.