错误必须提供“ ClientId”选项。构建Docker映像时 [英] Error The 'ClientId' option must be provided. When building a docker image

查看:313
本文介绍了错误必须提供“ ClientId”选项。构建Docker映像时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经启动了一个新的.net核心项目,并将其配置为使用Google+ Api进行身份验证。我的客户ID和密码是使用dotnet用户密码存储的。当我构建docker映像时,我得到

I've started a new .net core project and I configured it to use the Google+ Api for authentication. My Client Id and Secret are stored using dotnet user-secrets. When I build my docker image I get

 Unhandled Exception: System.ArgumentException: The 'ClientId' option must be provided.

我知道这是因为没有将我的秘密提供给图像。我想知道的是如何提供Id和Secret密钥而不将其提交到存储库,并且仍然在本地运行我的映像。

I know this is because my secrets aren't being provided to the image. What I want to know is how can I provide my Id and Secret key without committing them to the repository and still run my image locally.

我在考虑将其部署到服务器上时是否可以将它们作为Env变量的一部分,我想我也可以在本地进行,只是想知道是否还有其他人有一个比我更优雅的解决方案。

I was thinking when I deploy it to the server I can have them as part of the Env variables, I guess I could do that locally too, just wondering if anyone else has a solution for this that may be more elegant than mine.

我只是找不到很多有关其他人这样做的信息。

I just can't find much info on how others are doing this.

推荐答案

首先,秘密不是您应使用的秘密。通过帮助防止敏感数据存储在代码中/检查到源代码管理中,在开发过程中存在安全存储的秘密。请参阅相关问题 UserSecrets如何在云中工作?

First of all, secrets is not what you should use for deploying. Secrets exists for safe storage during development by helping prevent sensitive data from being storing in code / checked into source control. See related question How do UserSecrets work in the Cloud?

没错,您应该使用环境变量代替或替代一些外部设置存储,例如数据库。

And you are right, that you should use Environment Variables for instead, or as alternative, some external settings storage like DB.

这篇关于错误必须提供“ ClientId”选项。构建Docker映像时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆