gpt4 book ai didi

asp.net-core-webapi - 更改 appsettings.json GitHub Actions 中的配置值

转载 作者:行者123 更新时间:2023-12-05 03:35:00 27 4
gpt4 key购买 nike

我正在努力替换我的 appsettings.json 文件中的值,并且想知道我哪里出错了?

我在 GitHub 中创建了两个名为 COSMOSDBSETTINGS_SERVICEENDPOINTCOSMOSDBSETTINGS_AUTHKEY 的 secret 。

      - name: Publish
run: dotnet publish -c Release -o ${{env.DOTNET_ROOT}}/myapp

- name: App Settings Variable Substitution
uses: microsoft/variable-substitution@v1
with:
files: '${{env.DOTNET_ROOT}}\myapp\appsettings.json'
env:
CosmosDbSettings:ServiceEndpoint: ${{ secrets.COSMOSDBSETTINGS_SERVICEENDPOINT }}
CosmosDbSettings:AuthKey: ${{ secrets.COSMOSDBSETTINGS_AUTHKEY }}

我收到错误说明

Run microsoft/variable-substitution@v1
Applying variable substitution on JSON file: C:\Users\runneradmin\AppData\Local\Microsoft\dotnet\myapp\appsettings.json
Skipped updating file: C:\Users\runneradmin\AppData\Local\Microsoft\dotnet\myapp\appsettings.json
Error: Error: Failed to apply variable substitution

这是本地的 appsettings:

  "CosmosDbSettings": {
"ServiceEndpoint": "https://localhost:8081/",
"AuthKey": "KEY"
},

最佳答案

用点代替冒号:

env:
CosmosDbSettings.ServiceEndpoint: ${{ secrets.COSMOSDBSETTINGS_SERVICEENDPOINT }}
CosmosDbSettings.AuthKey: ${{ secrets.COSMOSDBSETTINGS_AUTHKEY }}

关于asp.net-core-webapi - 更改 appsettings.json GitHub Actions 中的配置值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69990675/

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