applications(java): add shared instructions for variables with dots#899
Open
applications(java): add shared instructions for variables with dots#899
Conversation
|
| ℹ️ Name | 🔗 Infos & links |
|---|---|
| 🌱 Deploying commit | 012cacb |
| 👁️ Preview | Generating preview app... |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR standardises JVM (Java/Scala) documentation around how Clever Cloud injects environment variables, including support for variable names containing dots by documenting their availability as JVM system properties.
Changes:
- Added a shared snippet (
shared/java-env-injection.md) describing JVM env injection and dotted-variable handling via-Dsystem properties. - Updated Java runtime docs (Gradle/Jar/Maven/War) to include the shared snippet instead of duplicating instructions.
- Updated Scala docs (general + Play 2) to include the same shared snippet for consistency.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| shared/java-env-injection.md | New shared JVM env-injection documentation, including dotted-name behaviour via system properties. |
| content/doc/applications/scala/play-framework-2.md | Switches to shared JVM env-injection snippet and tweaks Play-specific access guidance. |
| content/doc/applications/scala/_index.md | Switches Scala docs to shared JVM env-injection snippet. |
| content/doc/applications/java/java-war.md | Includes shared JVM env-injection snippet in WAR docs. |
| content/doc/applications/java/java-maven.md | Includes shared JVM env-injection snippet in Maven docs. |
| content/doc/applications/java/java-jar.md | Replaces inline env-injection section with shared snippet. |
| content/doc/applications/java/java-gradle.md | Replaces inline env-injection section with shared snippet. |
You can also share your feedback on Copilot code review. Take the survey.
Comment on lines
+3
to
+5
| Clever Cloud injects environment variables defined in the Console and by linked add-ons into your application. For JVM-based applications, all environment variables are passed as system properties using `-D` flags, making them accessible through `System.getProperty()`. | ||
|
|
||
| To access a standard environment variable such as `MY_VARIABLE`, use `System.getProperty("MY_VARIABLE")` or `System.getenv("MY_VARIABLE")`. |
|
|
||
| {{% content "env-injection" %}} | ||
| {{% content "java-env-injection" %}} | ||
|
|
Comment on lines
+11
to
+15
| For example, if you define `my.app.config=production` in the Clever Cloud Console, the JVM receives `-Dmy.app.config=production` at startup. You can then retrieve it with: | ||
|
|
||
| ```java | ||
| String value = System.getProperty("my.app.config"); // returns "production" | ||
| ``` |
Comment on lines
+3
to
+17
| Clever Cloud injects environment variables defined in the Console and by linked add-ons into your application. For JVM-based applications, all environment variables are passed as system properties using `-D` flags, making them accessible through `System.getProperty()`. | ||
|
|
||
| To access a standard environment variable such as `MY_VARIABLE`, use `System.getProperty("MY_VARIABLE")` or `System.getenv("MY_VARIABLE")`. | ||
|
|
||
| #### Variables with dots as JVM system properties | ||
|
|
||
| Environment variable names containing a dot (`.`) are handled differently. Since most shells do not support dots in variable names, these variables are passed exclusively as JVM system properties via `-D` flags, and are not set in the shell environment. | ||
|
|
||
| For example, if you define `my.app.config=production` in the Clever Cloud Console, the JVM receives `-Dmy.app.config=production` at startup. You can then retrieve it with: | ||
|
|
||
| ```java | ||
| String value = System.getProperty("my.app.config"); // returns "production" | ||
| ``` | ||
|
|
||
| This is useful for setting framework-specific properties directly from the Console without modifying configuration files (e.g. Spring Boot properties, Quarkus settings, or any custom `-D` parameter your application expects). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📝 What does this PR do?
This pull request standardizes and improves the documentation for environment variable injection in Java and Scala applications. The main update replaces previously scattered or inconsistent instructions with a single, shared content file that clearly explains how Clever Cloud injects environment variables for JVM-based applications, including details about variables with dots in their names.
Documentation standardization and improvement:
java-env-injection.md, providing a unified and detailed explanation of how Clever Cloud injects environment variables as JVM system properties and how to access them in Java and Scala applications. It also clarifies the handling of variables with dots in their names.java-gradle.md,java-jar.md,java-maven.md,java-war.md) to include the new shared environment injection content, replacing previous, less detailed instructions. [1] [2] [3] [4]_index.md,play-framework-2.md) to use the new shared content and clarify how to access environment variables, ensuring consistency with the Java docs. [1] [2]🔗 Related Issue (if applicable)
🧪 Type of Change
✅ Quick Checklist