diff --git a/src/__main__.py b/src/__main__.py index cc555c6..c23e98b 100644 --- a/src/__main__.py +++ b/src/__main__.py @@ -95,7 +95,7 @@ def main(): logger.info("No credentials provided with flags") if Path(".env").is_file(): logger.debug("Loading .env") - dotenv.load_dotenv() + dotenv.load_dotenv(Path(Path.cwd() / ".env")) else: logger.debug("No .env file found") try: @@ -106,7 +106,8 @@ def main(): logger.error("No credentials provided") argparser.print_help() exit(1) - + # For debugging, print cwd + logger.debug(f"Current working directory: {Path.cwd()}") try: args.func(args) except AttributeError: diff --git a/src/utils/utils.py b/src/utils/utils.py index 99e5d66..39db5cd 100644 --- a/src/utils/utils.py +++ b/src/utils/utils.py @@ -73,13 +73,13 @@ def convert_to_list(file: pathlib.Path) -> list: re.search(r"^(?:127\.0\.0\.1|0\.0\.0\.0|::1)\s+(.+?)(?:\s+#.+)?$", line) for line in f ] - hosts = [ + hosts = { match.group(1) for match in matches if match and match.group(1) not in loopback - ] + } # print(f"First 5 hosts: {hosts[:5]}") - return hosts + return list(hosts) # General Utils