在公共仓库连接字符串 [英] Connection string on public repository

查看:91
本文介绍了在公共仓库连接字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例如,我有爱好的项目 - ASP MVC应用程序。我想分享我的code。并得到一些反馈,或者,也许,有人会跟我一起开发的项目。我安装了它的公共存储库。

For example, I have hobby project - ASP MVC application. I want to share my code. And get some feedback, or, maybe, somebody will join me in development of the project. I setup public repository for it.

问题是以下几点:
如何我web.config中存储和连接字符串中吗?

它包含了我的SQLSERVER,密码和用户名的地址。它会被看到。它的安全漏洞。那么,什么是共同的解决方案?

It contains address of my SQLServer, password and username. It would be seen. It's security breach. So, what's the common solution?

推荐答案

在此情况下,不要存放在你的web.config连接字符串。其中将不会被提交到公共仓库一个单独的配置文件存储。如果您使用的git源控件添加此文件的.gitignore以确保其他开发商不会犯既不。

In this case don't store the connection string in your web.config. Store it in a separate config file which will not be committed to the public repository. If you are using git as source control add this file to .gitignore to ensure that other developers will not commit it neither.

然后与另一位开发人员如何能得到您的项目,并设置它在本地指令添加一个README文件。你甚至可以添加一些自动脚本。说明你的项目有依赖关系到SQL Server。既然你不想提供连接字符串以您个人的SQL Server给一步步从地方制定有需要下载SQL兼容版本,如何步指南在他们的计算机上安装它,并在文件中,他需要更新的连接字符串。如果你的项目依赖于一些最初播种数据,你可能需要提供脚本将初始化新创建的数据库。

Then add a README file with instructions on how another developer could get your project and set it up locally. You could even add some automated scripts. Explain that your project has a dependency to a SQL server and since you don't want to provide the connection string to your personal SQL server give a step by step guide from where the develop will need to download a compatible version of SQL, how to install it on their machines and in which file he needs to update the connection string. If your project depends on some initially seeded data you might need to provide scripts that will initialize the newly created database.

请记住:越少的步骤开发者需要在自己的机器上做(除了克隆你的公共仓库),较高的机会,你有他愿意为它作出贡献。理想的情况下点击一个按钮应该是所有为您的项目启动是必需的。

And remember: the less steps a developer needs to do on his own machine (in addition to cloning your public repository), the higher chances you have him willing to contribute on it. Ideally a button click should be all that it is required for your project to start.

这篇关于在公共仓库连接字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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