douhao2026 2016-09-23 21:40
浏览 31
已采纳

将App Engine与Go结合使用时,如何使密钥不回购?

I have an AppEngine Classic application written in Go, and as part of this, I have a number of keys which I would like to not have in the code repo.

I would like to have default keys in the repo for testing purposes, but keep the production keys secret. I know I can specify which files not to upload to the repo with my .gitignore file. However, I'm not sure what the best way to do this is so that other developers can build and tests the code without access to the file file.

What is the most practical way to keep keys out of the repo, while still having the code compile and test when the file with the keys is not present?

  • 写回答

1条回答 默认 最新

  • dsb53973 2016-09-25 23:14
    关注

    Since you want default (test) keys in the repo so others can test your code, but you want to keep your private keys secret (out of the repo), I'd go with the solution to have 2 separate folders, one for the test keys, one for the private keys.

    Obviously the private keys folder could go to .gitignore (and so will be kept out of repo), and you can decide the keys folder at runtime by a logic.

    The easiest logic would be to look for the private keys folder first (which will only exist in your computer), and if it doesn't exist, proceed with the test keys folder.

    You can spice up this logic e.g. with allowing with a cmd flag or env variable to bypass the private keys folder even if it exists. It would also be reasonable to only look for the private keys folder in production environment.

    But beware of / be aware that production code can be downloaded e.g. with the following command:

    appcfg.py download_app -A <your_app_id> -V <your_app_version> <output-dir>
    

    Only the developer who uploaded the code and the application owner(s) can download it.

    See more info about this here: Downloading Your Source Code

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 关于#python#的问题:求帮写python代码
  • ¥15 LiBeAs的带隙等于0.997eV,计算阴离子的N和P
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 来真人,不要ai!matlab有关常微分方程的问题求解决,
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿
  • ¥15 回答4f系统的像差计算
  • ¥15 java如何提取出pdf里的文字?