diff --git a/README.md b/README.md index 524c95f3abafffbe50bd8fde952d859603ad7504..0378b6840f1e5a4798fd45f56216530f09f3d191 100644 --- a/README.md +++ b/README.md @@ -4,4 +4,27 @@ Pyhton Konfigurationsklasse für YAML Dateien. ## Einbindung in andere Projekte Dieses Projekt ist selbst als python package Strukturiert und kann daher einfach -als git submodule direkt in andere Projekte eingebunden werden. \ No newline at end of file +als git submodule direkt in andere Projekte eingebunden werden. + +```bash +git submodule add git@git.imp.fu-berlin.de:coding-at-fu/yaml_config.git dict_filter +``` + +## Verwendung +Wurde das Projekt wie oben stehend eingebunden kann das Modul wie folgt verwendet werden: + +```python +from yaml_config import yaml_config + +config = yaml_config.YamlConfig(path = '/path/to/conf/file.yml') + +def do_whatever(): + config = yaml_config.YamlConfig.getInstance() + print (config.toDict().get('config_key')) + # wird foo ausgeben wenn config_key den Wert foo hat. + +def reconfigure(): + config = yaml_config.YamlConfig.getInstance() + config.reload() + # Die Konfiguration wurde neu eingelesen. +```