23 lines
		
	
	
		
			725 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			23 lines
		
	
	
		
			725 B
		
	
	
	
		
			Python
		
	
	
	
	
	
import os
 | 
						|
from dotenv import load_dotenv
 | 
						|
from types import MappingProxyType
 | 
						|
 | 
						|
 | 
						|
def get_cfg(env='qa'):
 | 
						|
    environment_name = os.getenv('ENV_NAME', env)
 | 
						|
    dotenv_path = f'.env.{environment_name}'
 | 
						|
    load_dotenv(dotenv_path)
 | 
						|
 | 
						|
    config_dict = {
 | 
						|
        'client_id': os.getenv('CLIENT_ID'),
 | 
						|
        'client_secret': os.getenv('CLIENT_SECRET'),
 | 
						|
        'token_url': os.getenv('TOKEN_FETCH_URL'),
 | 
						|
        'username': os.getenv('USERNAME'),
 | 
						|
        'password': os.getenv('PASSWORD'),
 | 
						|
        'audience': os.getenv('AUDIENCE'),
 | 
						|
        'scopes': os.getenv('SCOPES', '').split(','),
 | 
						|
        'api_url': os.getenv('API_URL')
 | 
						|
    }
 | 
						|
    config = MappingProxyType(config_dict)  # immutable dict
 | 
						|
    return config
 |