Skip to content

feat: add config file with Settings class for database credentials - #113

Merged
josdem merged 13 commits into
josdem:mainfrom
adityashirsatrao007:feature/112
Dec 11, 2025
Merged

feat: add config file with Settings class for database credentials#113
josdem merged 13 commits into
josdem:mainfrom
adityashirsatrao007:feature/112

Conversation

@adityashirsatrao007

Copy link
Copy Markdown
Collaborator

Summary

Adds a config module with a Settings class to read database credentials from environment variables.

Changes

  • Added \src/vetlog_buddy/config.py\ with \Settings\ class using \pydantic-settings\
  • Settings reads: \db_host, \db_name, \db_user, \db_password\ from env
  • Added \database_url\ property that returns MySQL connection string format
  • Added unit tests in \ ests/unit/test_config.py\

Testing

\
python -m pytest tests/unit/test_config.py -v
\\

Closes #112

Implements #112

- Add config.py with Settings class using pydantic-settings
- Add database_url property for MySQL connection string
- Add unit tests for Settings class
Copilot AI review requested due to automatic review settings December 10, 2025 17:56

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a new config.py module with a Settings class for managing database credentials via environment variables using pydantic-settings. However, this duplicates existing functionality already present in src/vetlog_buddy/shared/config.py, which has a more complete Settings class that includes the same database fields plus additional configuration (e.g., factor field) and proper .env file loading via a Config inner class.

Key Changes:

  • Added src/vetlog_buddy/config.py with a Settings class reading db_host, db_name, db_user, db_password from environment variables
  • Added database_url property that constructs MySQL connection strings
  • Added unit tests in tests/unit/test_config.py using unittest framework

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.

File Description
src/vetlog_buddy/config.py Introduces Settings class for database configuration, duplicating functionality from shared/config.py; lacks URL encoding for credentials and .env file loading configuration
tests/unit/test_config.py Adds unit tests for Settings class using unittest (inconsistent with project's pytest convention); missing test coverage for error cases and special character handling

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/unit/test_config.py Outdated
Comment thread src/vetlog_buddy/config.py Outdated
Comment thread src/vetlog_buddy/config.py Outdated
Comment thread tests/unit/test_config.py Outdated
Comment thread tests/unit/test_config.py Outdated
Comment thread tests/unit/test_config.py Outdated

@josdem josdem left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @adityashirsatrao007 ; I appreciate that you sent a PR, however you have several comments from Copilot, please address those, so we can merge your PR.

adityashirsatrao007 and others added 3 commits December 10, 2025 23:44
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

@josdem josdem left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only one more change to go and then we can merge. I appreciate your contriburion @adityashirsatrao007

Comment thread tests/unit/test_config.py Outdated
@josdem

josdem commented Dec 10, 2025

Copy link
Copy Markdown
Owner

@all-contributors please add @adityashirsatrao007 for code

@allcontributors

Copy link
Copy Markdown
Contributor

@josdem

I've put up a pull request to add @adityashirsatrao007! 🎉

@adityashirsatrao007

Copy link
Copy Markdown
Collaborator Author

@copilot open a new pull request to apply changes based on the comments in this thread

@adityashirsatrao007

Copy link
Copy Markdown
Collaborator Author

Quote reply

Done with the changes,you can check.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 7 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/unit/test_config.py Outdated
Comment thread tests/unit/test_config.py Outdated
Comment thread src/vetlog_buddy/shared/config.py
Comment thread tests/unit/test_config.py Outdated
Comment thread src/vetlog_buddy/config.py Outdated
Comment thread src/vetlog_buddy/config.py Outdated
Comment thread src/vetlog_buddy/config.py Outdated
@adityashirsatrao007

Copy link
Copy Markdown
Collaborator Author

@copilot open a new pull request to apply changes based on the comments in this thread

adityashirsatrao007 and others added 4 commits December 11, 2025 08:58
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@adityashirsatrao007

Copy link
Copy Markdown
Collaborator Author

@copilot open a new pull request to apply changes based on the comments in this thread

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/vetlog_buddy/shared/config.py
Comment thread src/vetlog_buddy/shared/config.py
Comment thread tests/unit/test_config.py
Comment thread tests/unit/test_config.py
Comment thread src/vetlog_buddy/config.py Outdated
adityashirsatrao007 and others added 3 commits December 11, 2025 09:14
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@adityashirsatrao007

Copy link
Copy Markdown
Collaborator Author

@copilot open a new pull request to apply changes based on the comments in this thread

@jgafnea jgafnea Dec 11, 2025

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Smart use of cache.

@jgafnea jgafnea left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved! Cached getter is a smart update for testability and cleaner DI.

@blu3-bird blu3-bird left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@josdem josdem left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks good to me, thanks for doing suggested changes @adityashirsatrao007 I appreciate it.

@josdem
josdem merged commit ce3b2ac into josdem:main Dec 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create a config file to read database credentials

5 participants