Skip to content

Commit

Permalink
add absolute file path to database ini
Browse files Browse the repository at this point in the history
  • Loading branch information
sureshhewabi committed Dec 5, 2023
1 parent 04f17ad commit 36564c4
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion app/routes/pride.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,14 @@
pride_router = APIRouter()
config = configparser.ConfigParser()

# Get the absolute path to the root directory
root_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '../..'))

# Specify the absolute path to the INI file
ini_path = os.path.join(root_path, 'database.ini')

# Read the INI file
config.read('database.ini')
config.read(ini_path)

# Access values from the INI file
API_KEY = config.get('security', 'apikey')
Expand Down

0 comments on commit 36564c4

Please sign in to comment.