fix: expand env vars when loading ov.conf JSON config files#908
Merged
qin-ctx merged 2 commits intovolcengine:mainfrom Mar 24, 2026
Merged
Conversation
Apply os.path.expandvars() to raw config text before JSON parsing in all
config-loading code paths, so that $VAR and ${VAR} placeholders in ov.conf
are resolved from the environment. This is especially useful for container
deployments where secrets are injected as environment variables.
Files changed:
- openviking_cli/utils/config/config_loader.py: load_json_config()
- openviking_cli/utils/config/open_viking_config.py: _load_from_file()
- openviking_cli/doctor.py: check_config(), check_embedding(), check_vlm(), check_disk()
- bot/vikingbot/config/loader.py: load_config() (already had this, no change)
The server config path (openviking/server/config.py -> load_server_config)
delegates to load_json_config() and is covered by the fix above.
|
Failed to generate code suggestions for PR |
MaojiaSheng
approved these changes
Mar 24, 2026
Collaborator
|
some conflicts need to be resolved |
# Conflicts: # openviking_cli/doctor.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request enhances configuration file handling across several modules by supporting environment variable expansion within JSON config files. This allows for greater flexibility, especially in containerized or variable deployment environments. The changes ensure that any
$VARor${VAR}placeholders in config files are replaced with their environment values before parsing, and this logic is consistently applied in all relevant config loading and validation functions.Configuration loading improvements:
bot/vikingbot/config/loader.py,openviking_cli/utils/config/config_loader.py, andopenviking_cli/utils/config/open_viking_config.pyto expand environment variables in JSON files before parsing, enabling dynamic configuration via environment variables. [1] [2] [3]import oswhere necessary to support environment variable expansion. [1] [2]CLI diagnostics enhancements:
openviking_cli/doctor.py(check_config,check_embedding,check_vlm,check_disk) to expand environment variables before loading JSON, ensuring that diagnostics reflect the effective configuration. [1] [2] [3] [4]Closes #909