我试图将yaml文件包含到Google App Engine的app.yaml中。

huangapple go评论85阅读模式
英文:

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.

huangapple
  • 本文由 发表于 2023年7月3日 05:52:57
  • 转载请务必保留本文链接:https://go.coder-hub.com/76600935.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定