Skip to content

Commit

Permalink
uses utilpack for envvar base
Browse files Browse the repository at this point in the history
  • Loading branch information
David Erb committed Feb 28, 2023
1 parent 3c2fe23 commit 5144775
Showing 1 changed file with 2 additions and 27 deletions.
29 changes: 2 additions & 27 deletions src/dls_multiconf_lib/envvar.py
Original file line number Diff line number Diff line change
@@ -1,32 +1,7 @@
import logging
import os
from dls_utilpack.envvar import Envvar as DlsUtilpackEnvvar

logger = logging.getLogger(__name__)


class Envvar:
class Envvar(DlsUtilpackEnvvar):
"""Class which covers environment variables, with default values."""

MULTICONF_CONFIGFILE = "MULTICONF_CONFIGFILE"

def __init__(self, name, **kwargs):

environ = kwargs.get("environ")

if environ is None:
environ = os.environ

self.name = name
self.is_set = False
self.value = None

if name in environ:
self.is_set = True
self.value = environ[name]
else:
if "default" in kwargs:
self.is_set = True
self.value = kwargs["default"]
else:
self.is_set = False
self.value = None

0 comments on commit 5144775

Please sign in to comment.