quarkiverse/quarkus-helm

Environment variables/system properties don't map

Closed this issue · 5 comments

version: 0.2.7

I noticed that a few of my custom properties in application.properties are not mapping.

A few of these properties have similar names. I wonder if this could be playing a role?

Additionally, none of the values from my system environment variables appear to be reading from the system in the generation of the chart.

The following configuration from application.properties:

total.test.pages=${TOTAL_TEST_PAGES:1}
security.app.key=${SECURE_APP_KEY:null}
adx.data=${ADX_DATA_ENDPOINT}
adx.appid=${ADX_APPID}
adx.appkey=${ADX_APPKEY}
adx.apptenant=${ADX_APPTENANT}
adx.database=${ADX_DB}

Should generate a fully featured values.yaml file but instead the system values are ignored and if fallbacks are provided, the fallbacks are used. (see below):

  envs:
    TOTAL_TEST_PAGES: "1"
    APP_ENV: Local
    SECURE_APP_KEY: "null"
    ADX_DATA_ENDPOINT: ""
    LOG_LOCATION: logs/quarkus.log
    ADX_DB: ""

I couldn't reproduce this issue. Can you provide a simple reproducer?

Hello! I have discovered the cause of the issue.

It's here

The line:

defaultValue = System.getProperty(systemProperty, defaultValue);

is limited to the Java environment only.

If you switch to System.getenv() instead, you can reference actual System environment variables.
https://www.baeldung.com/java-system-get-property-vs-system-getenv

I think this is all you would need to change to support system environment variables/secrets.

Thanks for your analysis, much appreciated! As you did much of the work, can you open a pull request with the fix?

Thanks for your analysis, much appreciated! As you did much of the work, can you open a pull request with the fix?

Can do!

@Sgitario I put in the PR. I have one test failing. I need to check to see if that was my doing. I made a few edits in the processor but not too many.