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: openid-connect yml conf could not use $env to set plugin properties #11319

Open
150149 opened this issue Jun 4, 2024 · 3 comments
Open

Comments

@150149
Copy link

150149 commented Jun 4, 2024

Current Behavior

When I use yaml config to set plugin properties, apisix openid-connect plugin could not read $env://KEYCLOAK_PWDvalue.
Environment variable can be seen through linux cmd:

echo $KEYCLOAK_PWD

But apisix plugin could not read those config properties

Expected Behavior

Apisix plugin can read those config properties

Error Logs

No response

Steps to Reproduce

  1. Create config(Show only key code)
  - uri: /api/xxx/*
    service_id: xxxx
    plugins:
      openid-connect:
        client_id: xxx
        client_secret: $ENV://KEYCLOAK_PWD
        discovery: xxxx
        scope: openid

Environment

  • APISIX version (3.2.0):
  • Operating system (Linux 3.10.0-1160.118.1.el7.x86_64 SMP Thu Apr 4 03:33:23 EDT 2024 x86_64 x86_64 x86_64 GNU/Linux):
  • OpenResty / Nginx version (openresty/1.21.4.2):
  • etcd version, if relevant (not use):
  • APISIX Dashboard version, if relevant(not use)
@kayx23
Copy link
Member

kayx23 commented Jun 5, 2024

Could you change $env: to all caps and try again? I remember some time ago there was a PR allowing ENV to be lower case, but that was definitely available after 3.2.0.

@150149
Copy link
Author

150149 commented Jun 5, 2024

Could you change $env: to all caps and try again? I remember some time ago there was a PR allowing ENV to be lower case, but that was definitely available after 3.2.0.

client_secret: $ENV://FS_KEYCLOAK_PWD

Emmmm.....I've tried all caps and it doesn't work.

@darkSheep404
Copy link
Contributor

darkSheep404 commented Aug 9, 2024

By checking
you need to add
local fetch_secrets = require("apisix.secret").fetch_secrets
and

function _M.rewrite(plugin_conf, ctx)
    local conf = fetch_secrets(plugin_conf)

like
#11451

@150149 150149 changed the title bug: yml conf could not use $env to set plugin properties bug: openid-connect yml conf could not use $env to set plugin properties Aug 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 📋 Backlog
Development

No branches or pull requests

3 participants