Skip to content

Fix: Move Pinecone index and namespace to environment variables#163

Open
Rinta13795 wants to merge 1 commit into
c2siorg:mainfrom
Rinta13795:fix-pinecone-config-env-vars
Open

Fix: Move Pinecone index and namespace to environment variables#163
Rinta13795 wants to merge 1 commit into
c2siorg:mainfrom
Rinta13795:fix-pinecone-config-env-vars

Conversation

@Rinta13795

Copy link
Copy Markdown

Fix: Move Pinecone index and namespace to environment variables

Description

Problem:

  • models/NewsModel.py hardcoded index_name as 'cybernews-hybrid-test-2'
  • models/NewsModel.py hardcoded namespace as 'c2si'
  • db_update/Update.py hardcoded namespace as 'c2si'
  • Prevented multi-environment deployment

Solution:

  • Read PINECONE_INDEX_NAME from env (default: 'cybernews-index')
  • Read PINECONE_NAMESPACE from env (default: 'c2si')
  • Added both variables to .env.example
  • Maintains backward compatibility

Related Issue

Fixes #111

Motivation and Context

This change allows the project to be deployed in multiple environments (dev/staging/prod) without code modifications. Users can now configure different Pinecone indexes and namespaces via environment variables.

How Has This Been Tested?

  • Verified environment variable loading in both models/NewsModel.py and db_update/Update.py
  • Tested backward compatibility with default values
  • Both online queries and offline updates are now configurable

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Problem:
- models/NewsModel.py hardcoded index_name as 'cybernews-hybrid-test-2'
- models/NewsModel.py hardcoded namespace as 'c2si'
- db_update/Update.py hardcoded namespace as 'c2si'
- Prevented multi-environment deployment

Solution:
- Read PINECONE_INDEX_NAME from env (default: 'cybernews-index')
- Read PINECONE_NAMESPACE from env (default: 'c2si')
- Added both variables to .env.example
- Maintains backward compatibility

Testing:
- Verified environment variable loading
- Both online queries and offline updates now configurable

Fixes c2siorg#111
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.

Pinecone namespace is hardcoded to "c2si"

1 participant