如何为不同的服务器配置 Catalyst 应用程序?

发布于 2024-08-05 15:46:28 字数 344 浏览 1 评论 0原文

我正在计划一个 Catalyst 应用程序,它将部署在许多服务器上。它将由支持人员在内部使用来控制在这些服务器上运行的操作系统的各个方面。

除了有限数量的站点特定行为之外,应用程序将在每台服务器上以大致相同的方式运行。某些操作仅适用于某些服务器,而某些操作在其他服务器上的行为会有所不同。

是否有任何公认的设计模式/实践可以实现 Catalyst 应用程序的特定于站点的定制?

我目前正在考虑与应用程序一起部署站点配置文件,该文件将用于确定要启用的操作,并设置控制其他操作行为的参数。理想情况下,这种定制会在 mod_perl (Apache2) 加载应用程序时发生 - 但我不确定这是否可能。

欢迎任何建议!

I am planning a Catalyst application, that will be deployed over a number of servers. It will be used internally by support staff to control aspects of an operational system that runs on those servers.

The application will run much in the same way on each server, save for a limited amount of site specific behaviours. Some actions will only apply to some servers, and some actions will behave differently on other servers.

Are there any recognized design patterns/practices that enable site-specific customization of a Catalyst application?

I am currently thinking of deploying a site configuration file alongside the application, that will be used to determine what actions to enable, and set parameters that control other action's behaviour. Ideally this customization would happen when the application is loaded by mod_perl (Apache2) - but I am not sure if that would even be possible.

Any suggestions welcome!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

两仪 2024-08-12 15:46:28

Catalyst::Plugin::ConfigLoader 的代码可帮助您以 MYAPP_CONFIG_LOCAL_SUFFIX 环境变量的形式进行特定于站点的配置。由于控制器是组件,并且配置在 setup_components 时可用,因此在编译控制器时,您可以通过操作注册做任何您想做的蠢事。由于每个人的要求都不同,所以没有太多预先准备的内容,但这并不是特别困难,并且可以在邮件列表中找到建议。

Catalyst::Plugin::ConfigLoader has code to help you with site-specific configuration in the form of the MYAPP_CONFIG_LOCAL_SUFFIX environment variable. Since Controllers are Components and config is available at setup_components time, you can do whatever foolery you want with action registration when your controller is compiled. There's not much pre-rolled for it, because everyone's requirements are so different, but it's not exceptionally hard, and there's advice to be found on the mailing list.

女皇必胜 2024-08-12 15:46:28

您可以设置模板,或根据 $c->req->host 的值在控制器中设置条件行为。

You can set templates, or have conditional behaviour in the controllers based on the value of $c->req->host.

感受沵的脚步 2024-08-12 15:46:28

我总是使用 $HOSTNAME$USER 的独特组合来定义要加载的特定配置文件,例如

conf => "my_app_${hostname}_${user}.conf"

I always use the unique combination of $HOSTNAME and $USER to define the specific configuration file to be loaded, e.g.

conf => "my_app_${hostname}_${user}.conf"
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文