~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to configs/README.txt

  • Committer: Curtis Hovey
  • Date: 2011-12-18 15:13:07 UTC
  • mto: This revision was merged to the branch mainline in revision 14547.
  • Revision ID: curtis.hovey@canonical.com-20111218151307-sdm2gzobt5tplbe0
Moved badges to lp.app.

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
bootstrapped into the Zope startup process.
29
29
 
30
30
 
31
 
== LaunchpadConfig ==
 
31
== CanonicalConfig ==
32
32
 
33
 
Launchpad uses a singleton LaunchpadConfig object to select the config
 
33
Launchpad uses a singleton CanonicalConfig object to select the config
34
34
to load and manage its state.
35
35
 
36
36
 
46
46
to force the testrunner configuration to be loaded.
47
47
 
48
48
An instance directory may contain several lazr.config conf files.
49
 
LaunchpadConfig loads the config file named for the process that is
50
 
running, eg. if the processes name is 'test', LaunchpadConfig looks for
 
49
CanonicalConfig loads the config file named for the process that is
 
50
running, eg. if the processes name is 'test', CanonicalConfig looks for
51
51
test-lazr.conf. launchpad-lazr.conf is loaded if not a lazr config files
52
52
named for the process.
53
53
 
64
64
    '.../configs/development/launchpad-lazr.conf'
65
65
 
66
66
 
67
 
=== Accessing the LaunchpadConfig in code ===
68
 
 
69
 
The LaunchpadConfig singleton is exposed as config in its module.
70
 
 
71
 
    from lp.services.config import config
 
67
=== Accessing the CanonicalConfig in code ===
 
68
 
 
69
The CanonicalConfig singleton is exposed as config in its module.
 
70
 
 
71
    from canonical.config import config
72
72
 
73
73
The config can be accessed as a dictionary...
74
74
 
86
86
    >>> config.librarian.download_port
87
87
    58000
88
88
 
89
 
You can learn more about lp.services.config in the doctest located at
 
89
You can learn more about canonical.config in the doctest located at
90
90
 
91
91
    lib/canonical/launchpad/doc/canonical-config.txt
92
92
 
93
93
 
94
 
=== Testing with LaunchpadConfig ===
 
94
=== Testing with CanonicalConfig ===
95
95
 
96
96
Configurations are meant to be immutable--applications should never
97
97
alter the config. Nor should tests. Older code and tests assumed
98
98
that because the keys looked like attributes of the config, they
99
99
could be set. This was *wrong*. The code was actually adding an
100
 
attribute to the LaunchpadConfig instance rather that updating to
 
100
attribute to the CanonicalConfig instance rather that updating to
101
101
underlying config object. While the code intended to reset the key's
102
102
value to the original value, it would have to delete the new attribute
103
103
to really restore the config singleton.
104
104
 
105
 
LaunchpadConfig supports testing by exposing lazr.config's push() and
 
105
CanonicalConfig supports testing by exposing lazr.config's push() and
106
106
pop() methods to add and remove configurations to the stack of
107
107
ConfigData. The configuration can be modified and safely restored.
108
108
 
128
128
== lazr.conf schema and confs ==
129
129
 
130
130
All Launchpad configs inherit from the Launchpad schema defined
131
 
in ../lib/lp/services/config/schema-lazr.conf (it is symlinked
 
131
in ../lib/canonical/config/schema-lazr.conf (it is symlinked
132
132
as ./schema-lazr.conf for convenience).
133
133
 
134
134
lazr.config conf and schema files look like ini-based conf files, but
273
273
The lazr configurations in this directory descend from the
274
274
Launchpad schema. This is a general outline of inheritance:
275
275
 
276
 
    ../lib/lp/services/config/schema-lazr.conf
 
276
    ../lib/canonical/config/schema-lazr.conf
277
277
        |
278
278
        + development/launchpad-lazr.conf
279
279
        |    |
354
354
    # This configuration derives from:
355
355
    #     ./configs/production/launchpad-lazr.conf
356
356
    #     ./configs/lpnet-lazr.conf
357
 
    #     ./lib/lp/services/config/schema-lazr.conf
 
357
    #     ./lib/canonical/config/schema-lazr.conf
358
358
 
359
359
    [answertracker]
360
 
    # Defined in: lib/lp/services/config/schema-lazr.conf
 
360
    # Defined in: lib/canonical/config/schema-lazr.conf
361
361
    days_before_expiration: 15
362
362
 
363
 
    # Defined in: lib/lp/services/config/schema-lazr.conf
 
363
    # Defined in: lib/canonical/config/schema-lazr.conf
364
364
    dbuser: answertracker
365
365
 
366
 
    # Defined in: lib/lp/services/config/schema-lazr.conf
 
366
    # Defined in: lib/canonical/config/schema-lazr.conf
367
367
    email_domain: answers.launchpad.net
368
368