Skip to content

help request: use environment variables in plugins configuration #9727

Description

@ikatlinsky

Description

I am trying to use an environment variables approach described here https://apisix.apache.org/docs/apisix/terminology/secret/#use-environment-variables-to-manage-secrets to configure authz-keycloak plugin.

For that, I use the following configuration (created via admin api):

{
"uris": [
    "/manual/httpbin/*"
  ],
  "name": "manual httpbin",
  "methods": [
    "GET"
  ],
  "hosts": [
    "api.msp.komus.local"
  ],
  "upstream_id": "...",
  "plugins": {
		"proxy-rewrite": {
			"regex_uri": [
						"^\/manual\/httpbin\/(.*)",
						"\/$1"
			]
		},
		"authz-keycloak":{
			"discovery": "$ENV://KEYCLOAK_DISCOVERY",
			"client_id": "<KEYCLOAK_CLIENT_ID>",
			"policy_enforcement_mode": "PERMISSIVE",
			"ssl_verify": false
		}
	}
}

Environment variable KEYCLOAK_DISCOVERY is defined and is accessible for the gateway. However the environment variable is not resolved, the following error is in the logs.

[error] 50#50: *44516 [lua] authz-keycloak.lua:240: authz_keycloak_discover(): Accessing discovery URL ($ENV://KEYCLOAK_DISCOVERY) failed: bad uri: $ENV://KEYCLOAK_DISCOVERY

Can someone point me into the right direction?

Environment

  • APISIX version (run apisix version): 3.3.0
  • Operating system (run uname -a): Linux 6.1.32-0-virt
  • OpenResty / Nginx version (run openresty -V or nginx -V): openresty/1.21.4.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions