mirror of
https://github.com/avatao-content/baseimage-tutorial-framework
synced 2024-11-01 01:01:22 +00:00
13 lines
446 B
Python
13 lines
446 B
Python
# Copyright (C) 2018 Avatao.com Innovative Learning Kft.
|
|
# All Rights Reserved. See LICENSE file for details.
|
|
|
|
from collections import namedtuple
|
|
from os import environ
|
|
|
|
|
|
def prefixed_envvars_to_namedtuple(prefix: str, tuple_name: str):
|
|
envvars = {envvar.replace(prefix, '', 1): environ.get(envvar)
|
|
for envvar in environ.keys()
|
|
if envvar.startswith(prefix)}
|
|
return namedtuple(tuple_name, envvars)(**envvars)
|