Skip to content

Conversation

@fghpdf
Copy link

@fghpdf fghpdf commented Jan 8, 2026

Description

This PR adds support for lowercase proxy environment variables as a fallback when uppercase versions are not set.

Changes

  • Added fallback logic in SetDefault() method to check lowercase http_proxy, https_proxy, and no_proxy when uppercase versions (HTTP_PROXY, HTTPS_PROXY, NO_PROXY) are empty
  • Added new helper function setDefaultStringFromEnv() to read from environment variables

Fixes

Fixes langgenius/dify#18752

Testing

  • Code compiles successfully
  • Follows the same pattern as other configuration defaults in the codebase

Behavior

  • If HTTP_PROXY is set, it will be used (backward compatible)
  • If HTTP_PROXY is empty but http_proxy is set, http_proxy will be used
  • Same logic applies to HTTPS_PROXY/https_proxy and NO_PROXY/no_proxy

Nov1c444 and others added 30 commits March 24, 2025 09:21
BUGFIX: fix AutoGetWithGetter will never hit cache issue.
…ible

make pathStyle param configurable when using s3 compatible storage
feat: simplify the process in db migrate & fix comment error
…internal-use

Add get/delete implement, for internal use.
feat: add ConvertAnyMap function and corresponding tests for map conv…
…hon_version

fix: some time uv venv wrong python version
fix: thread safety issue and len inaccuracy in Map
Yeuoly and others added 18 commits December 9, 2025 14:56
* fix: align multimodal permission mapping

* fix: implement mock interface for multimodal embeddings

* fix: support multimodal embedding

* fix: incorrect reference
…and upgrade (langgenius#526)

* add locking to prevent simultaneous installations of the same plugin
* ensure proper unlocking of keys in case of errors during installation and upgrade
* handle database not found error in DeletePluginInstallationItemFromTask
* fix: remove tenant ID reference from plugin readme service

* fix: rename PluginReadme to PluginReadmeRecord to remove tenant ID reference

* fix: handle error when saving plugin readme map to database

* fix: remove TenantId from FetchPluginReadme request binding

* fix: standardize error message casing for plugin unique identifier validation
…anggenius#536)

* refactor: remove uuid-ossp dependency and update ID generation logic

* fix: condition error
* fix: plugin log not display after refactor

* Update internal/core/local_runtime/notifier_logger.go

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

* feat: add logging support for local runtime instance events

---------

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: Yeuoly <[email protected]>
…anggenius#539)

* Update internal/types/app/config.go

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

* Update internal/server/server.go

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

---------

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
* feat: add support for PgBouncer in database initialization

* refactor: consolidate gorm configuration for database connection

* Add MySQL and multi-driver DB integration tests (langgenius#535)

* feat: streamline integration tests by using a centralized docker-compose file

* fix: add timeout

* refactor: replace inline service definitions with docker-compose action for integration tests

* fix: update pgbouncer image and environment variable names for consistency
…e not found (langgenius#549)

* fix PluginDaemonInternalServerError: no available node, plugin runtime not found

Fix the bug where after a plugin is successfully upgraded, new requests result in the plugin daemon service responding with "no available node, plugin runtime not found".

The root cause is that when the plugin is upgraded successfully, the corresponding value in Redis is not updated. Consequently, when a new request arrives, it reads the outdated plugin version from Redis and fails to locate the correct runtime.

* raise error if failed
…s#552)

* use slog instead of log package and format to new log schema

* update the environment name to LOG_OUTPUT_FORMAT

* add the env to .env.example

* fix log reference error

* change the order of milldlewares

* delete unused code

* fix the concurrently session potential race condition

* fix the log format in tests

* update the duplicate code

* refactor: convert log functions to slog structured format

- Change log.Error/Info/Warn/Debug/Panic to accept msg + key-value pairs
- Remove printf-style formatting from log functions
- Update log calls in internal/cluster, internal/db, internal/core/session_manager
- Remove unused 'initialized' variable from log package
- Remaining files will be updated in follow-up commits

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>

* refactor: update all log call sites to use slog structured format

Convert all log.Error, log.Info, log.Warn, log.Debug, and log.Panic
calls from printf-style formatting to slog key-value pairs.

Before: log.Error("failed to do something: %s", err.Error())
After:  log.Error("failed to do something", "error", err)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>

* refactor: update cmd/ log calls to use slog structured format

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>

* feat: implement GnetLogger for structured logging in gnet

* refactor: remove deprecated log visibility functions and related calls

* feat: enhance session management with trace and identity context propagation

* feat: implement serverless transaction handler and writer for plugin runtime

* refactor: rename context field to traceCtx in RealBackwardsInvocation

---------

Co-authored-by: Claude Opus 4.5 <[email protected]>
Co-authored-by: Yeuoly <[email protected]>
- Add fallback to lowercase http_proxy/https_proxy/no_proxy when uppercase versions are empty
- Fixes langgenius/dify#18752
@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Jan 8, 2026
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @fghpdf, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the application's proxy configuration handling by introducing a fallback mechanism for environment variables. It ensures that if standard uppercase proxy variables like HTTP_PROXY are not defined, the system will automatically check for and use their lowercase equivalents such as http_proxy. This change improves the robustness and flexibility of proxy settings, accommodating various system configurations without breaking existing behavior.

Highlights

  • Proxy Environment Variable Fallback: Implemented a fallback mechanism to support lowercase proxy environment variables (http_proxy, https_proxy, no_proxy) if their uppercase counterparts are not explicitly set.
  • New Helper Function: Introduced a new helper function, setDefaultStringFromEnv, to streamline the process of reading and applying environment variable values as defaults.
  • Configuration Logic Update: Modified the SetDefault() method to incorporate the new fallback logic for proxy settings, ensuring broader compatibility for proxy configurations.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request correctly adds fallback support for lowercase proxy environment variables (http_proxy, https_proxy, no_proxy) when their uppercase counterparts are not set. The implementation is sound and achieves the goal described. I've included a couple of suggestions to refactor the changes by reusing an existing helper function. This would improve code maintainability and reduce duplication. Overall, this is a good and useful addition.

Comment on lines 45 to 47
setDefaultStringFromEnv(&config.HttpProxy, "http_proxy")
setDefaultStringFromEnv(&config.HttpsProxy, "https_proxy")
setDefaultStringFromEnv(&config.NoProxy, "no_proxy")
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

To improve code reuse and maintainability, you can leverage the existing setDefaultString function here. This avoids introducing a new, specialized helper function (setDefaultStringFromEnv). The os.Getenv call is inexpensive, and this approach keeps the helper functions more generic.

I've added another comment suggesting the removal of the setDefaultStringFromEnv function definition, which would be redundant with this change.

Suggested change
setDefaultStringFromEnv(&config.HttpProxy, "http_proxy")
setDefaultStringFromEnv(&config.HttpsProxy, "https_proxy")
setDefaultStringFromEnv(&config.NoProxy, "no_proxy")
setDefaultString(&config.HttpProxy, os.Getenv("http_proxy"))
setDefaultString(&config.HttpsProxy, os.Getenv("https_proxy"))
setDefaultString(&config.NoProxy, os.Getenv("no_proxy"))

Comment on lines 67 to 71
func setDefaultStringFromEnv(value *string, envKey string) {
if *value == "" {
*value = os.Getenv(envKey)
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Following the suggestion to use the existing setDefaultString function for setting proxy fallbacks, this new setDefaultStringFromEnv function is no longer needed and can be removed to reduce code duplication and improve maintainability.

@dosubot dosubot bot added the bug Something isn't working label Jan 8, 2026
@dosubot dosubot bot added size:XS This PR changes 0-9 lines, ignoring generated files. and removed size:S This PR changes 10-29 lines, ignoring generated files. labels Jan 9, 2026
@fghpdf fghpdf closed this Jan 9, 2026
@fghpdf fghpdf force-pushed the fix/issue-18752-proxy-env-fallback branch from 9c4cf3e to 15503bc Compare January 9, 2026 05:10
@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. and removed size:XS This PR changes 0-9 lines, ignoring generated files. labels Jan 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The http proxy environment variable of Dify plugin_daemon only supports uppercase letters.