Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: enhance config options, support env vars #385

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Cheelax wants to merge 3 commits into coderamp-labs:main
base: main
Choose a base branch
Loading
from Cheelax:improve-env

Conversation

Copy link

@Cheelax Cheelax commented Jul 5, 2025
edited by filipchristiansen
Loading

Closes #285

  • add support for environment variables (GITINGEST_*) to override config.py defaults
  • implement a precedence hierarchy: CLI/Python args → environment variables → default values
  • introduce new CLI options (--max-files, --max-total-size, --max-directory-depth).
  • centralise environment variable utilities in utils/config_utils.py with functions _get_str_env_var and _get_int_env_var
  • add configuration examples to README.md
  • tidy and update docstrings
  • update tests
  • add missing --tag CLI flag
  • remove isort in favour of ruff.lint.isort
  • remove unused constants BASE_DIR and TEMPLATE_DIR in tests/server/test_flow_integration.py
  • rename constant templates to JINJA_TEMPLATES in src/server/server_config.py
  • move Colors from src/server/server_utils.py to src/gitingest/utils/colors.py to break circular import chain

Copy link
Contributor

Thanks for your work @Cheelax. I have rebase upon main and added a commit with the following:

Refactor

  • Deduplicate _get_env_var by moving it to utils/config_utils.py.
  • Remove redundant local_path parameter from _process_file.

Fix

  • Add missing tag parameter to _async_main, main, and _CLIArgs.
  • Introduce the missing --tag CLI flag.

Docs and consistency

  • Update README.md for markdownlint compliance and other minor tweaks.
  • Add missing argument docs to _async_main docstring.
  • Re-order global variables in config.py for consistency.
  • Swap the order of include_patterns and ignore_patterns in parse_query and ingest_async.
  • Tidy docstrings for _async_main, IngestionQuery, parse_query, ingest_async, and ingest.

Tests

  • Temporarily disable [tool.ruff.lint.isort] due to conflict with the isort pre-commit hook.
  • Add new arguments to expected in test_parse_query_without_host.
  • Run pre-commit hooks.

TODO

  • The environment variable names such as GITINGEST_MAX_FILE_SIZE) do not seem to align with the names used and looked for in _get_env_var`.

  • The _get_env_var function returns int | str which causes downstream problems when the variables set with this functions are used (Type "int | str" is incompatible with type "int").

This comment was marked as resolved.

Copy link
Author

Cheelax commented Jul 23, 2025

@filipchristiansen Hello, any news on this?

Copy link
Contributor

@filipchristiansen Hello, any news on this?

The code crashes when running the server locally, possibly due to a circular import. I will have a look at it.

Copy link
Contributor

refactor(config,lint): centralize env utils, switch to ruff.isort, drop unused constants

  • remove isort in favour of ruff.lint.isort
  • remove unused constants BASE_DIR and TEMPLATE_DIR in tests/test_flow_integration.py
  • rename constant templates to JINJA_TEMPLATES in src/server/server_config.py
  • move function definition of _get_int_env_var from src/server/server_config.py to src/gitingest/utils/config_utils.py
  • remove duplicated function definition of _get_int_env_var in src/gitingest/config.py
  • rename function _get_env_var to _get_str_env_var for clarity
  • move Colors from src/server/server_utils.py to src/gitingest/utils/colors.py to break circular import chain

@filipchristiansen filipchristiansen changed the title (削除) Enhance configuration options (削除ここまで) (追記) feat: enhance configuration options (追記ここまで) Jul 23, 2025
Copy link
Contributor

filipchristiansen commented Jul 23, 2025
edited
Loading

@Cheelax The branch needs to be rebase upon main

Update: Done

Closes coderamp-labs#285
* add support for environment variables (`GITINGEST_*`) to override `config.py` defaults
* implement a precedence hierarchy: CLI/Python args → environment variables → default values
* introduce new CLI options (`--max-files`, `--max-total-size`, `--max-directory-depth`).
* centralise environment variable utilities in `utils/config_utils.py` with functions `_get_str_env_var` and `_get_int_env_var`
* add configuration examples to `README.md`
* tidy and update docstrings
* update tests
* add missing `--tag` CLI flag
* remove `isort` in favour of `ruff.lint.isort`
* remove unused constants `BASE_DIR` and `TEMPLATE_DIR` in `tests/server/test_flow_integration.py`
* rename constant `templates` to `JINJA_TEMPLATES` in `src/server/server_config.py`
* move `Colors` from `src/server/server_utils.py` to `src/gitingest/utils/colors.py` to break circular import chain
Co-authored-by: Cheelax <thomas.belloc@gmail.com>
@filipchristiansen filipchristiansen changed the title (削除) feat: enhance configuration options (削除ここまで) (追記) ### feat(config): enhance config options, support env vars (追記ここまで) Jul 24, 2025
@filipchristiansen filipchristiansen changed the title (削除) ### feat(config): enhance config options, support env vars (削除ここまで) (追記) feat(config): enhance config options, support env vars (追記ここまで) Jul 24, 2025
@filipchristiansen filipchristiansen changed the title (削除) feat(config): enhance config options, support env vars (削除ここまで) (追記) feat: enhance config options, support env vars (追記ここまで) Jul 24, 2025
Copy link
Contributor

@ix-56h ix-56h left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

ix-56h commented Jul 25, 2025

@filipchristiansen i'll let add your review and merge it.

Copy link

This pull request has merge conflicts that must be resolved before it can be merged.

Copy link

This pull request has resolved merge conflicts and is ready for review.

Copy link

This pull request has merge conflicts that must be resolved before it can be merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers

@NicolasIRAGNE NicolasIRAGNE NicolasIRAGNE left review comments

@ix-56h ix-56h ix-56h approved these changes

+1 more reviewer

@filipchristiansen filipchristiansen filipchristiansen left review comments

Reviewers whose approvals may not affect merge requirements

At least 1 approving review is required to merge this pull request.

Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

feat: config parameters as environment variables

AltStyle によって変換されたページ (->オリジナル) /