gpt4 book ai didi

Docker Compose 嵌套环境变量

转载 作者:行者123 更新时间:2023-12-02 04:21:21 29 4
gpt4 key购买 nike

我有一个现有的应用程序,它使用如下所示的应用程序配置文件:

"ConnectionInfo": {
"ServerName": "The Server URL",
"DatabaseName": "The DatabaseName",
"UserName": "The User Name",
"Password": "The Password"}

现在,当我有一个简单的设置时,比如说

"ConnectionString":"My Connection String"

我了解如何在 compose.yml 文件中覆盖它:

environment:
- ConnectionString=what I want it to be

问题是,如何设置顶部的服务器名称?

最佳答案

请使用双下划线(__)代替冒号(:)。

environment:
- ConnectionInfo__ServerName=MyServerName

请引用Configuration in ASP.NET Core

For hierarchical config values specified in environment variables, a colon (:) may not work on all platforms. Double underscore (__) is supported by all platforms.

关于Docker Compose 嵌套环境变量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45889233/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com