Skip to content

feat: Enhance scan-missing-env-vars.py to detect defaults, types, and categorize output #503

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

Merged
merged 5 commits into from
Apr 19, 2025

Conversation

silentoplayz
Copy link
Collaborator

@silentoplayz silentoplayz commented Apr 16, 2025

Pull Request Checklist

Changelog Entry

Description

  • Improved the scan-missing-env-vars.py script to provide more detailed information about environment variable usage in the codebase. The script now detects default values, infers variable types, and categorizes undocumented variables for better analysis of environment variable configurations.

Added

  • Detection of default values for environment variables accessed via os.getenv, os.environ.get, and PersistentConfig.
  • Inference of variable types (str, int, bool, list[dict], dict, tuple, set) for environment variables, especially within PersistentConfig.
  • Categorized output for undocumented environment variables, separating PersistentConfig variables from other undocumented variables.
  • Output includes default values and inferred types for undocumented variables.
  • Filenames are now tracked to show where each environment variable is accessed.

Changed

  • The find_env_vars function now returns a dictionary containing detailed context for each environment variable (files, default, type) instead of just a set of variable names.
  • The output format is enhanced to display default values, types, and file locations for undocumented variables.

Fixed

  • Improved accuracy and detail in environment variable scanning compared to the original script, providing a more comprehensive analysis.

Additional Information

  • This script is used internally to help maintain documentation and ensure all necessary environment variables are documented. The enhanced script provides more granular information, making it easier to identify and document environment variables, especially those used with PersistentConfig and those with default values and specific types.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
@tjbck
Copy link
Contributor

tjbck commented Apr 19, 2025

💪

@tjbck tjbck merged commit 157a2ec into open-webui:main Apr 19, 2025
1 check failed
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.

None yet

2 participants