Skip to content

Comments

Set default API base to apis-imp.cogsol.ai#9

Merged
luciabouza merged 7 commits intomainfrom
csp-1640/update.env_example
Feb 20, 2026
Merged

Set default API base to apis-imp.cogsol.ai#9
luciabouza merged 7 commits intomainfrom
csp-1640/update.env_example

Conversation

@luciabouza
Copy link
Contributor

Description

Brief description of changes.

Type of Change

  • [X ] Bug fix (non-breaking change that fixes an issue)

Related Issues

Fixes #6

Changes Made

Provide default COGSOL_API_BASE and COGSOL_CONTENT_API_BASE values across the project and update docs/.env examples to use https://apis-imp.cogsol.ai. Code changes add fallbacks for the API and Content API base URLs in core client, agents, content, and management commands (chat, importagent, ingest, migrate, startproject, topics) so the app won't fail when env vars are missing. README and documentation examples were updated accordingly, and typing-extensions was added to pyproject.toml dependencies.

Testing Done

  • Tested manually

Checklist

  • [ X] My code follows the project's style guidelines
  • [ X] I have performed a self-review of my code
  • [ X] I have commented my code, particularly in hard-to-understand areas
  • [ X] I have made corresponding changes to the documentation
  • [ X] My changes generate no new warnings
  • [ X] New and existing unit tests pass locally with my changes

Provide default COGSOL_API_BASE and COGSOL_CONTENT_API_BASE values across the project and update docs/.env examples to use https://apis-imp.cogsol.ai. Code changes add fallbacks for the API and Content API base URLs in core client, agents, content, and management commands (chat, importagent, ingest, migrate, startproject, topics) so the app won't fail when env vars are missing. README and documentation examples were updated accordingly, and typing-extensions was added to pyproject.toml dependencies.
Reformat long environment variable and default URL assignments into multi-line, parenthesized expressions across multiple modules (cogsol/agents, cogsol/content, cogsol/core/api.py, and management commands: importagent, ingest, migrate, topics) to improve readability and line-length compliance. These changes are stylistic only and do not alter runtime behavior.
Import os at module level and read COGSOL_API_BASE and COGSOL_CONTENT_API_BASE via os.environ.get with provided fallback URLs, instead of calling self._env for those values. Keep api_key retrieval via _env. Remove the redundant import inside the _env helper. This provides sensible defaults for running migrations when those env vars are not set.
Copy link
Contributor

@nsuruguay05 nsuruguay05 left a comment

Choose a reason for hiding this comment

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

Great. A couple of suggestions:

  • Maybe add a constants.py file that contains the two URLs as constants, and use those constants everywhere instead of hardcoding the URLs directly (since they’re repeated a lot, and it’ll be easier to change them if we ever need to).
  • In the file management/commands/startproject.py (line 198), the .env.example for the scaffolding is created with localhost in COGSOL_API_BASE and COGSOL_CONTENT_API_BASE. I’d remove those two directly from the .env.example, since most people will use the default ones anyway (maybe I’d do the same in the documentation: remove them from the example .env files).

Add cogsol/core/constants.py to centralize resolving CogSol API base URLs (cognitive and content) and environment handling (COGSOL_ENV). Replace scattered hardcoded default URLs with helper functions (get_cognitive_api_base_url, get_content_api_base_url) across client, agents, content, and management commands. Update startproject .env.example and docs to remove embedded default base URLs and simplify configuration examples. Also remove several ad-hoc settings/import fallbacks in CLI commands in favor of the unified environment-based resolution.
@luciabouza luciabouza merged commit 0c4f954 into main Feb 20, 2026
13 checks passed
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.

[BUG] Change URL's in .env.example

2 participants