Last active
August 14, 2023 21:43
-
-
Save alichherawalla/411b1bccd3383c2948aeb129e0b70040 to your computer and use it in GitHub Desktop.
Reusable env related functions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import sys | |
from awsglue.utils import getResolvedOptions | |
def load_env(environment): | |
if environment == "local": | |
from dotenv import load_dotenv | |
load_dotenv(".env") | |
def get_env_or_args(env_name): | |
try: | |
if os.environ.get(env_name): | |
return os.getenv(env_name) | |
else: | |
return getResolvedOptions(sys.argv,[env_name])[env_name] | |
except: | |
return '' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment