apache / apisix-java-plugin-runner

APISIX Plugin Runner in Java
https://apisix.apache.org/
Apache License 2.0
128 stars 95 forks source link

request help: How to get Spring env value from Docker environment #240

Open vttranlina opened 1 year ago

vttranlina commented 1 year ago

Issue description

As I know the plugin is based on the Spring framework. I have configured below in the application.yaml:

redis:
  url: ${REDIS_URL:redis://localhost:6379}

Now, I want to set REDIS_URL by the docker environment. Eg:

  apisix:
    container_name: apisix.example.com
    image: apisix:3.2.0-debian-javaplugin
    volumes:
      - ./apisix/conf/config.yaml:/usr/local/apisix/conf/config.yaml
    environment:
      - REDIS_URL=redis://kimchi:6379

My trace

Environment

ext-plugin: path_for_test: /tmp/runner.sock cmd: ['java', '-jar', '-Xmx1g', '-Xms1g', '/usr/local/apisix/token_revoker_plugin.jar']

vttranlina commented 1 year ago

It looks imposible, From the document

Nginx will hide all environment variables by default https://apisix.apache.org/docs/apisix/external-plugin/#when-managing-by-apisix-the-runner-cant-access-my-environment-variable