1

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!

4

3 回答 3

4

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

于 2009-09-20T02:25:11.077 回答
0

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

conf => "my_app_${hostname}_${user}.conf"
于 2009-10-30T21:43:54.827 回答
0

您可以设置模板,或在控制器中基于$c->req->host.

于 2009-09-19T01:48:37.447 回答