Skip to content
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

bug: Configuration errors due to environment variables sharing prefixes #11239

Open
ilya-tishonok opened this issue May 8, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@ilya-tishonok
Copy link

Current Behavior

When running Apache APISIX in standalone mode, there seems to be an issue with the environment variable substitution mechanism where variables with a common prefix are not correctly recognized. This results in the wrong values being used for certain configuration settings.

For example for configuration (apisix.yaml):

organizations_server:
  keepalive_pool: ${{ORGANIZATIONS_SERVER_KEEPALIVE_POOL}}
  keepalive_timeout: ${{ORGANIZATIONS_SERVER_KEEPALIVE_TIMEOUT}}
  keepalive: ${{ORGANIZATIONS_SERVER_KEEPALIVE}}

and envs:
ORGANIZATIONS_SERVER_KEEPALIVE_POOL=60000
ORGANIZATIONS_SERVER_KEEPALIVE_TIMEOUT=10000
ORGANIZATIONS_SERVER_KEEPALIVE=wrong_value

values for keepalive_pool and keepalive_timeout are incorrectly populated with the value of ORGANIZATIONS_SERVER_KEEPALIVE (i.e., wrong_value).

Expected Behavior

Configuration values should be correctly populated according to their corresponding environment variables based on unique, fully matched variable names.

Error Logs

image

Steps to Reproduce

  1. Ensure basic config.yaml and apisix.yaml configurations are set up for APISIX in standalone mode.
  2. Modify the configuration to reference environment variables that share the same prefix but are intended for different settings. For example, include references to TEST_ENV_CORRECT and TEST_ENV in the configuration as follows:
example_config:
  correct_value: ${{TEST_ENV_CORRECT}}
  base_value: ${{TEST_ENV}}
  1. Set the environment variables to different values:
    TEST_ENV_CORRECT=expected_value
    TEST_ENV=base_value
  2. Start APISIX.

Environment

  • Docker image: apache/apisix:3.8.0-debian
@shreemaan-abhishek shreemaan-abhishek added the bug Something isn't working label May 9, 2024
@hanqingwu
Copy link
Contributor

the same as #11121 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: 📋 Backlog
Development

No branches or pull requests

3 participants