Skip to content

Commit

Permalink
Merge pull request #1 from ps428/main
Browse files Browse the repository at this point in the history
Resolved the import error, updated the readme
  • Loading branch information
kdcokenny authored Jun 14, 2023
2 parents c9c7ae7 + 180f991 commit 72adc08
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
9 changes: 7 additions & 2 deletions elapse_secrets/main.py
Original file line number Diff line number Diff line change
@@ -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)

Expand All @@ -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)

Expand Down Expand Up @@ -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)
return process_regex('db','rules-elapse-stable.yml', text)

0 comments on commit 72adc08

Please sign in to comment.