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

Object Storage doesn't work with environment variables #10726

Open
burtbeckwith opened this issue Apr 16, 2024 · 1 comment
Open

Object Storage doesn't work with environment variables #10726

burtbeckwith opened this issue Apr 16, 2024 · 1 comment
Labels
type: bug Something isn't working

Comments

@burtbeckwith
Copy link
Member

Expected Behavior

I should be able to specify object storage properties as env vars, e.g. MICRONAUT_OBJECT_STORAGE_ORACLE_CLOUD_DEFAULT_BUCKET for micronaut.object-storage.oracle-cloud.default.bucket and MICRONAUT_OBJECT_STORAGE_ORACLE_CLOUD_DEFAULT_NAMESPACE for micronaut.object-storage.oracle-cloud.default.namespace

Actual Behaviour

Values are only resolved from config files.

I discussed this with Alvaro and although this affects Object Storage, it's likely a core bug.

Steps To Reproduce

Create an app

mn create-app --build=gradle --features=object-storage-oracle-cloud com.example.objstoragebug

Add printlns to Application.java to display resolved values (see attached project)

Specify bucket and namespace as env vars, either with

export MICRONAUT_OBJECT_STORAGE_ORACLE_CLOUD_DEFAULT_BUCKET=foo
export MICRONAUT_OBJECT_STORAGE_ORACLE_CLOUD_DEFAULT_NAMESPACE=bar
./gradlew run

or

MICRONAUT_OBJECT_STORAGE_ORACLE_CLOUD_DEFAULT_BUCKET=foo MICRONAUT_OBJECT_STORAGE_ORACLE_CLOUD_DEFAULT_NAMESPACE=bar ./gradlew run

In both cases the properties are correctly read and available from the ApplicationContext, but there is no enabled ObjectStorageOperations bean (should be io.micronaut.objectstorage.oraclecloud.OracleCloudStorageOperations)

If you hard code the values in application.properties, or in application-foo.properties and run with the "foo" env enabled, it works.

One other weird combination works. If I specify env vars and have one or more related properties in application.properties, it works. Uncomment

micronaut.object-storage.oracle-cloud.default.enabled=true

in application.properties in the attached app and run with env vars and everything works as expected. Note that any of the 3 properties will cause this, it's not related to the value being true since the default is true.

Environment Information

No response

Example Application

No response

Version

4.3.8

@burtbeckwith
Copy link
Member Author

objstoragebug.zip

@alvarosanchez alvarosanchez added the type: bug Something isn't working label Apr 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
Status: No status
Development

No branches or pull requests

2 participants