diff --git a/README.md b/README.md index 3fd97ed..371e6c5 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ The package provides two main functions: This is a basic usage example. ```python -from elapse_secrets_filters import filter_elapse_secrets +from elapse_secrets import filter_elapse_secrets text_with_secrets = "My AWS Access Key is AKIAYOURACCESSKEYHERE" filtered_text = filter_elapse_secrets(text_with_secrets) diff --git a/elapse_secrets/main.py b/elapse_secrets/main.py index d22b8ab..da37d9a 100644 --- a/elapse_secrets/main.py +++ b/elapse_secrets/main.py @@ -1,6 +1,9 @@ import yaml import re import logging +import os + +current_dir = os.path.dirname(os.path.abspath(__file__)) logging.basicConfig(level=logging.INFO) @@ -11,7 +14,8 @@ def clean_regex(regex): cleaned = cleaned.replace("(?-i)", "") return cleaned -def process_regex(yaml_file, text): +def process_regex(folder,filename, text): + yaml_file = os.path.join(current_dir,folder,filename) with open(yaml_file, 'r') as stream: y = yaml.safe_load(stream) @@ -44,4 +48,5 @@ def process_regex(yaml_file, text): return stripped_text def filter_elapse_secrets(text: str): - return process_regex('elapse_secrets/db/rules-elapse-stable.yml', text) \ No newline at end of file + return process_regex('db','rules-elapse-stable.yml', text) +