allow default value for configs
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
parent
a28bc5ffeb
commit
983b67fe18
4
lib.py
4
lib.py
@ -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)
|
Loading…
x
Reference in New Issue
Block a user