allow default value for configs
continuous-integration/drone/push Build is failing

This commit is contained in:
jfmonty2 committed 2020-12-27 20:27:02 -08:00
1 parent a28bc5ffeb
commit 983b67fe18
1 file changed
+3 -1
+3 -1
View File
@@ -26,11 +26,13 @@ class MineBot(commands.Bot):
await super().close()
def getconfig(key):
def getconfig(key, default=None):
if key in os.environ:
return os.environ[key]
elif f'{key}_FILE' in os.environ:
p = os.environ[f'{key}_FILE']
return pathlib.Path(p).read_text()
elif default != None:
return default
else:
raise ConfigError('Missing config:', key)