英文:
I’m trying to include yaml files into app.yaml for Google App Engine
问题
我想将secrets(API密钥、密码)从app.yaml文件中分离出来,放到一个独立的yaml文件中,这个文件不包括在我的GitHub项目存储库中。
我不知道是否可能,也不知道如何包含文件(或另一个文件中的密钥)的语法是什么。我尝试在Google上搜索(持续了几天),但找不到满足我的需求的任何内容。
以下是我想要实现的示例:
app.yaml:
env_variables:
INSTANCE_CONNECTION_NAME: example-database-name
includes:
secrets.yaml
然后有一个secrets.yaml文件,其中包含:
DB_USER: root
DB_PASS: foobar
DB_NAME: example_name
英文:
I want to separate secrets (API Keys, passwords) from app.yaml into their own separated yaml file which is not part of my github project repo.
I have no clue if it’s possible or what the syntax would be to include a file (or keys from another file). I tried searching on Google (for days) but could not find anything that satisfies my needs.
Here is an example of what I'm trying to achieve:
app.yaml:
env_variables:
INSTANCE_CONNECTION_NAME: example-database-name
includes:
secrets.yaml
and than a secrets.yaml file with:
DB_USER: root
DB_PASS: foobar
DB_NAME: example_name
答案1
得分: 0
变量需要放在env_variables
块内:
secrets.yaml
env_variables:
DB_USER: 'root'
然后像您已经做的那样包括这个文件:
includes:
- secrets.yaml
尽管从长远来看,我建议使用Secrets Manager来保存这些密钥。
英文:
the variables need to be inside env_variables
block:
secrets.yaml
env_variables:
DB_USER: 'root'
then include this file as you already do:
includes:
- secrets.yaml
Although in long term I'd recommend to use Secrets Manager for saving the secrets.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论