Skip to content

Bug: FALKORDB_PORT default type inconsistency across modules #582

@gkorland

Description

@gkorland

Description

FALKORDB_PORT is retrieved with inconsistent default types across modules:

Integer default (5 locations):

# api/graph.py, api/git_utils/git_graph.py, api/llm.py
port=os.getenv('FALKORDB_PORT', 6379)  # default is int

String default with explicit cast (1 location):

# api/info.py
port=int(os.getenv('FALKORDB_PORT', "6379"))  # default is str, explicitly cast

os.getenv() always returns a string when the var is set. When it's not set, the default 6379 (int) is passed directly to the port parameter. Depending on how the FalkorDB client handles the port parameter, this may work by accident or fail silently.

Suggested Fix

Consistently use:

port=int(os.getenv('FALKORDB_PORT', '6379'))

Or better yet, centralize configuration in a single place.

Context

Found during code review of PR #522.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions