覆盖 Orchard CMS 中的连接字符串(来自 settings.txt)
我在 AppHarbor 中部署了一个使用 MS SQL 数据库的网站。 AppHarbor 为我提供了一个在 settings.txt
中输入的连接字符串,它似乎工作正常,但 AppHarbor 建议使用 SQLSERVER_CONNECTION_STRING
变量。
这是因为连接字符串可能会在没有通知的情况下发生更改,因此唯一安全的方法是使用提到的变量。
应该访问下面的配置变量 以编程方式,因为附加组件提供商可能会更新这些值 恕不另行通知。
有没有办法覆盖 settings.txt
中的 DataConnectionString
设置并将应用程序设置为使用 SQLSERVER_CONNECTION_STRING
变量?我假设 AppHarbor 以某种方式将这些变量设置为 appSettings。
PS这是我第一次使用Orchard应用程序,我不熟悉这个CMS。
I deployed a web site in AppHarbor which uses a MS SQL database. AppHarbor provides me with a connection string which I entered in settings.txt
and it seems to work fine BUT AppHarbor suggests to use the SQLSERVER_CONNECTION_STRING
variable instead.
That is because the connection string may change without notice so the only safe way is to use the variable mentioned.
Accessing the configuration variables below should be done
programatically, as the values may be updated by the add-on provider
without notice.
Is there a way to override the DataConnectionString
setting from settings.txt
and set the application to use the SQLSERVER_CONNECTION_STRING
variable instead? I assume AppHarbor somehow sets those variables as appSettings.
P.S. This is my first application with Orchard, I am not proficient with this CMS.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
连接字符串在 ShellSettingsManager 类中设置。我不确定您是否可以轻松地从模块中替换此依赖项,但您当然可以更改设置连接字符串的代码行...
ShellSettingsManager 是 IShellSettingsManager 的实现,因此如果您只想也实现你自己的。
The connection string is set in the ShellSettingsManager class. I'm not sure you can easily replace this dependency from a module, but you could certainly just change the line of code that sets the connections string...
ShellSettingsManager is an implementation of IShellSettingsManager so you have some flexibility there if you want to just implement your own too.
我刚刚将我的“Configuration Shell Settings” 模块 (Fineout.ConfigShellSettings) 发布到 Orchard Gallery。该模块最终提供了一种通过配置管理来管理 Orchard 站点(租户)shell 设置的轻松方法。
下载Orchard Gallery 中的 Configuration Shell 设置模块!
我复制了下面的模块包描述(版本 1.0.1):
由于这是该模块的初始版本,我预计会有很大的改进空间和偶尔的错误;我很乐意接受任何人的反馈或想法。我希望这一贡献对社区有用且节省时间。
I've just published my "Configuration Shell Settings" module (Fineout.ConfigShellSettings) to the Orchard Gallery. This module finally provides a painless way to manage Orchard site (tenant) shell settings via configuration management.
Download the Configuration Shell Settings module from the Orchard Gallery!
I've copied the module package description (version 1.0.1) below:
As this is the initial version of the module, I expect there will be plenty of room for improvement and the occasional bug; I'd love any feedback or ideas anyone has. I hope this contribution will prove useful and time-saving for the community.
将 Orchard 部署到 Appharbor 可能不值得。 Appharbor 在进行部署时会清除整个应用程序,因此上传的媒体也会被清除。您可以通过将媒体文件夹托管在其他地方(例如 amazon s3)来解决此问题。
但您也无法通过 FTP 访问日志文件或其他任何内容。 (至少不是我上次看的时候)。
另外你不能利用网络部署。
您可以让它工作,但果园架构与 appharbor 的部署模型产生了很大的摩擦。
别误会我的意思。我爱阿法伯。但果园是方形的。我的视力在 appharbor 上工作,但 4 个月后我发现我害怕更新,因为太多非默认设置。最后,我认输了,每月在arvixe支付8美元。现在摩擦少多了。
Deploying orchard to appharbor might not be worth the effort. Appharbor wipes out the entire app when doing a deploy so uploaded media gets wiped out too. You can get around this by hosting the media folder somewhere else, like amazon s3.
But you also don't have FTP access to log files or anything else. (at least not the last time I looked).
Plus u can't take advantage of web deploy.
You can make it work but orchards architecture creates much friction with appharbor's deployment model.
Don't get me wrong. I love appharbor. But orchard is square peg. I got my sight working on appharbor but 4 months later I found I was afraid to update because too many non default settings. Finally, threw in towel and paid $8 per month at arvixe. Much less friction now.