Georg Pfuetzenreuter
75c2411dd2
Read a configuration file mapping bcrypt hashed tokens to authorized paths and methods to decide whether a request should be pursued. Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
15 lines
323 B
Python
15 lines
323 B
Python
from yaml import safe_load
|
|
from os import getenv
|
|
|
|
configpath = getenv('NFT-API-CONFIG')
|
|
if not configpath:
|
|
raise RuntimeError('NFT-API-CONFIG is not set')
|
|
|
|
with open(configpath) as fh:
|
|
configdata = safe_load(fh)
|
|
|
|
config = configdata.get('nft-api', {})
|
|
|
|
if not config:
|
|
raise RuntimeError('Invalid configuration data')
|