Skip to content

Commit 6b9c3c1

Browse files
JohTCopilot
andauthored
Add error message when password is missing
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent a06c4bb commit 6b9c3c1

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

domains/external-dependencies/externalDependencyCharts.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,18 @@ def parse_parameters() -> Parameters:
108108

109109

110110
def connect_to_graph_database() -> Driver:
111+
password = os.environ.get("NEO4J_INITIAL_PASSWORD")
112+
if not password:
113+
print(
114+
f"{SCRIPT_NAME}: Environment variable NEO4J_INITIAL_PASSWORD must be set and non-empty "
115+
"before connecting to Neo4j.",
116+
file=sys.stderr,
117+
)
118+
sys.exit(1)
119+
111120
graph_driver = GraphDatabase.driver(
112121
uri="bolt://localhost:7687",
113-
auth=("neo4j", os.environ.get("NEO4J_INITIAL_PASSWORD", "")),
122+
auth=("neo4j", password),
114123
)
115124
graph_driver.verify_connectivity()
116125
print(f"{SCRIPT_NAME}: Successfully connected to Neo4j")

0 commit comments

Comments
 (0)