gpt4 book ai didi

azure - 使用 Azure Devops 更新 .net core 中的 appsettings.json 值

转载 作者:行者123 更新时间:2023-12-03 03:57:25 25 4
gpt4 key购买 nike

我在 DevOps 领域相对较新,自从我们的 DevOps 人员离开后,我正在努力帮助我的团队。

我们正在通过 Github/Azure 管道部署应用程序,没有任何问题,但当涉及到更新 appsettings.json 文件中的值时,我们无法做到这一点。

这是我们的 appsettings.json 文件的示例:

{
"ConnectionStrings": {
"DefaultConnection": "Server=tcp:ourserver.database.windows.net,1433;Initial Catalog=db;Persist Security Info=False;User ID=sampleuserid;Password=12321321321;"
},
"Stripe": {
"SecretKey": "sk_live_addsd123213312O8756A",
"WebHookSecret": "whsec_Adsa8sd67i343ij3ij"
}
}

我们想要更新 Stripe 的 SecretKey 和 WebHookSecret 值。

我们有什么选择?

我了解到我们可以添加 Azure 应用程序设置服务任务并包含其中的值,我应该这样做吗?

enter image description here

附注我为 Stripe 设置的值仅用于演示目的。

最佳答案

请使用 Stripe__WebHookSecret 而不是 WebHookSecret,但这不会更新您的 appsettings.json。它将在 Web 应用程序配置中设置设置,该设置将覆盖文件中的值(如果在门户中定义了这些值)。这是正确的做法。绝对比更新文件更好。

您还可以尝试使用 Stripe:WebHookSecret - 请检查此 site .

关于azure - 使用 Azure Devops 更新 .net core 中的 appsettings.json 值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64051554/

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