Coverage for core/shared.py: 100%

5 statements  

« prev     ^ index     » next       coverage.py v7.8.0, created at 2025-05-05 14:02 +0000

1"""Shared code""" 

2 

3import os 

4 

5from dotenv import load_dotenv 

6 

7 

8load_dotenv() 

9 

10 

11def getenv(env, default=""): 

12 """ 

13 Retrieve the value of an environment variable, stripping any surrounding 

14 single or double quotes. 

15 

16 Args: 

17 env (str): The name of the environment variable to retrieve. 

18 default (Any, optional): The default value to return if the environment 

19 variable is not set. Defaults to None. 

20 

21 Returns: 

22 str: The value of the environment variable with surrounding quotes removed, 

23 or the default value if the environment variable is not set. 

24 """ 

25 return os.getenv(env, default).strip("'").strip('"')