commit 6e62499dd19d741cfdf7743921dcb42f7777b685
parent 0f894ed3a3ad2800ae51ebda29a4bfd040bc9de5
Author: nolash <dev@holbrook.no>
Date: Tue, 20 Oct 2020 06:16:35 +0200
Add optional default value arg to get
Diffstat:
3 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
@@ -1,7 +1,11 @@
-0.2.3
+0.2.5
+ - Add default value as second argument to get
+0.2.4
- Published on pypi.org
+0.2.3
+ - (skipped)
0.2.2
- - (Skipped)
+ - (skipped)
0.2.1
- Set logger name
- Omit empty string environment variables
diff --git a/confini/config.py b/confini/config.py
@@ -137,8 +137,12 @@ class Config:
return v
- def get(self, k):
+ def get(self, k, default=None):
v = self.store.get(k)
+ if v == None:
+ if default != None:
+ logg.debug('returning default value for {}'.format(k))
+ return default
return self._decrypt(k, v)
diff --git a/setup.py b/setup.py
@@ -6,8 +6,7 @@ f.close()
setup(
name='confini',
- #version='0.2.1',
- version='0.2.3',
+ version='0.2.5',
description='Parse, verify and merge all ini files in a single directory',
author='Louis Holbrook',
author_email='dev@holbrook.no',