2015-12-19 14:52:17 +01:00
|
|
|
title: get_config
|
|
|
|
---
|
|
|
|
type: method
|
|
|
|
---
|
|
|
|
signature: fresh=False
|
|
|
|
---
|
|
|
|
summary: Returns a loaded config for the plugin as ini file.
|
|
|
|
---
|
|
|
|
body:
|
|
|
|
|
|
|
|
This loads the config of the plugin as an [Ini File :ext](https://github.com/mitsuhiko/python-inifile).
|
|
|
|
|
|
|
|
Dotted paths are used to navigate into sections. So `get('foo.bar')` would
|
|
|
|
navigate to the `bar` key in the `[foo]` section.
|
|
|
|
|
|
|
|
## Example
|
|
|
|
|
|
|
|
```python
|
|
|
|
from lektor.pluginsystem import Plugin
|
|
|
|
|
|
|
|
|
|
|
|
class MyPlugin(Plugin):
|
|
|
|
|
2022-03-20 00:37:08 +01:00
|
|
|
def on_setup_env(self, **extra):
|
2015-12-19 14:52:17 +01:00
|
|
|
color = self.get_config().get('color')
|
|
|
|
self.env.jinja_env.globals['my_color'] = color
|
|
|
|
```
|