最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

.net - UserSecrets per LaunchProfile - Stack Overflow

programmeradmin1浏览0评论

I have different launchProfiles in my dotnet project and I would like the passwords to be saved in the secrets.json, but I do not manage to do so.

So the launchsettings look like this:

{
    "profiles": {
        "httpsSomethingElse": {
            "environmentVariables": {
                "ASPNETCORE_ENVIRONMENT": "Development",
                "mariadb_database": "something1",
                "mariadb_username": "something2",
                "mariadb_password": "something3",
               
            }
        },
        "httpsSomething": {
            "environmentVariables": {
                "ASPNETCORE_ENVIRONMENT": "Development",
                "mariadb_database": "something4",
                "mariadb_username": "something5",
                "mariadb_password": "something6",
               
            }
        },
        "httpsLocal": {
            "environmentVariables": {
                "ASPNETCORE_ENVIRONMENT": "Development",
                "mariadb_database": "something8",
                "mariadb_username": "something7",
                "mariadb_password": "something0",
               
            }
        },
    },
}

Maybe I am failing to do the format of the secrets.json properly, but none of these formats here works:

{
  "httpsSomething": {
    "environmentVariables": {
      "mariadb_username": "something",
      "mariadb_password": "something",
      "mqtt_hostname": "something"
    }
  },
  "profile": {
      "httpsSomething": {
        "environmentVariables": {
          "mariadb_username": "something",
          "mariadb_password": "something",
          "mqtt_hostname": "something"
        }
      },
  }
  "httpsSomething__environmentVariables__mariadb_username": "something",
  "httpsSomething__environmentVariables__mariadb_password": "something",
  "httpsSomething__environmentVariables__mqtt_hostname": "something",
  }
}

The reason why I tried all sorts of different approaches here is because different manuals in the internet showed different ways of doing it.

What is the proper way to do so? Maybe its not supported by secrets.json in general?

发布评论

评论列表(0)

  1. 暂无评论