1Catalyst::Plugin::ConfiUgsLeoradCeorn:t:rMiabnuutaeldC(a3Pt)earllysDto:c:uPmleungtiant:i:oCnonfigLoader::Manual(3)
2
3
4

NAME

6       Catalyst::Plugin::ConfigLoader::Manual - Guide to using the
7       ConfigLoader plugin
8

BASIC USAGE

10           package MyApp;
11
12           use Catalyst qw( ConfigLoader ... );
13

ENVIRONMENT VARIABLES

15       ·   "MYAPP_CONFIG" - specific config file to load for "MyApp"
16
17       ·   "CATALYST_CONFIG_LOCAL_SUFFIX" - global suffix for extra config
18           files
19
20       ·   "MYAPP_CONFIG_LOCAL_SUFFIX" - suffix specifically for "MyApp"
21

CONFIG FORMATS

23   Config::General
24       Extensions
25
26       ·   cnf
27
28       ·   conf
29
30       Example Config
31
32           name = TestApp
33           <Component Controller::Foo>
34               foo bar
35           </Component>
36           <Model Baz>
37               qux xyzzy
38           </Model>
39
40   INI
41       Extensions
42
43       ·   ini
44
45       Example Config
46
47           name=TestApp
48
49           [Controller::Foo]
50           foo=bar
51
52           [Model::Baz]
53           qux=xyzzy
54
55   JSON
56       Extensions
57
58       ·   jsn
59
60       ·   json
61
62       Example Config
63
64           {
65               "name": "TestApp",
66               "Controller::Foo": {
67                   "foo": "bar"
68               },
69               "Model::Baz": {
70                   "qux": "xyzzy"
71               }
72           }
73
74   Perl
75       Extensions
76
77       ·   pl
78
79       ·   perl
80
81       Example Config
82
83           {
84               name => 'TestApp',
85               'Controller::Foo' => {
86                   foo => 'bar'
87               },
88               'Model::Baz' => {
89                   qux => 'xyzzy'
90               }
91           }
92
93   XML
94       Extensions
95
96       ·   xml
97
98       Example Config
99
100           <config>
101               <name>TestApp</name>
102               <component name="Controller::Foo">
103                   <foo>bar</foo>
104               </component>
105               <model name="Baz">
106                   <qux>xyzzy</qux>
107               </model>
108           </config>
109
110   YAML
111       Extensions
112
113       ·   yml
114
115       ·   yaml
116
117       Example Config
118
119           ---
120           name: TestApp
121           Controller::Foo:
122               foo: bar
123           Model::Baz:
124               qux: xyzzy
125

COOKBOOK

127   Configuring a Catalyst::Model::DBIC::Schema model from a YAML config
128           Model::MyModel:
129             schema_class: MyApp::MySchema
130             connect_info:
131               - dbi:SQLite:myapp.db
132               - ''
133               - ''
134               - AutoCommit: 1
135
136   Converting your existing config to Config::General format
137       As of Catalyst::Devel 1.07, a newly created application will use
138       Config::General for configuration. If you wish to convert your existing
139       config, run the following one-liner (replacing MyApp with your app's
140       name):
141
142           perl -Ilib -MMyApp -MConfig::General -e 'Config::General->new->save_file("myapp.conf", MyApp->config);'
143
144   Using UTF-8 strings in a Config::General file
145       If you have UTF-8 strings in your Config::General-based config file,
146       you should add the following config information to MyApp.pm:
147
148           __PACKAGE__->config( 'Plugin::ConfigLoader' => {
149               driver => {
150                   'General' => { -UTF8 => 1 },
151               }
152           } );
153
154   Using a local configuration file
155       When ConfigLoader reads configurations, it starts by reading the
156       configuration file for "myapp" with one of the supported extensions as
157       listed above.
158
159       For example, A Config::General config file is "myapp.conf".
160
161       If a configuration file called "myapp_local" exists with one of the
162       supported file extensions, it will also be read, and values from that
163       file will override values from the main config file.
164
165       A Config::General local configuration file would be called
166       "myapp_local.conf".
167
168       The "local" suffix can be changed.  See "get_config_local_suffix" in
169       Catalyst::Plugin::ConfigLoader for the details of how.
170
171       This is useful because it allows different people or environments to
172       have different configuration files.  A project with three developers,
173       Tom, Dick, and Harry as well as a production environment can have a
174       "myapp_tom.conf", a "myapp_dick.conf", a "myapp_harry.conf", and a
175       "myapp_production.conf".
176
177       Each developer, and the web server, would set the environment variable
178       to load their proper configuration file.  All of the configurations can
179       be stored properly in source control.
180
181       If there is no "myapp.local", and the individual configuration files
182       contain something required to start the application, such as the
183       Model's data source definition, the applicaton won't start unless the
184       environment variable is set properly.
185
186
187
188perl v5.12.0                      2009C-a0t5a-l2y6st::Plugin::ConfigLoader::Manual(3)
Impressum