Skip to content

Commit c9d3bab

Browse files
committed
Better security config reading
1 parent a758da6 commit c9d3bab

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

src/murfey/cli/repost_failed_calls.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import argparse
22
import json
3-
import os
43
from datetime import datetime
54
from functools import partial
65
from pathlib import Path
@@ -10,6 +9,8 @@
109
from jose import jwt
1110
from workflows.transport.pika_transport import PikaTransport
1211

12+
from murfey.util.config import security_from_file
13+
1314

1415
def dlq_purge(
1516
dlq_dump_path: Path, queue: str, rabbitmq_credentials: Path
@@ -133,11 +134,8 @@ def run():
133134
)
134135
args = parser.parse_args()
135136

136-
# Set the environment variable then read it by importing the security config
137-
os.environ["MURFEY_SECURITY_CONFIGURATION"] = args.config
138-
from murfey.util.config import get_security_config
139-
140-
security_config = get_security_config()
137+
# Read the security config file
138+
security_config = security_from_file(args.config)
141139

142140
# Get the token to post to the api with
143141
token = jwt.encode(

tests/conftest.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import json
2-
import os
32

43
import pytest
54
from sqlmodel import Session
@@ -35,4 +34,3 @@ def mock_security_configuration(tmp_path):
3534
}
3635
with open(config_file, "w") as f:
3736
json.dump(security_config, f)
38-
os.environ["MURFEY_SECURITY_CONFIGURATION"] = str(config_file)

0 commit comments

Comments
 (0)