New feature: Update spring boot properties file for postgresql#4707
New feature: Update spring boot properties file for postgresql#4707rujche wants to merge 21 commits intoAzure:mainfrom rujche:feature/update-spring-boot-properties-file-for-postgresql
Conversation
|
Hi, @saragluna , @weikanglim |
| name: '{{bicepName .Name}}' | ||
| params: { | ||
| name: '{{.Name}}' | ||
| name: '{{containerAppName .Name}}' |
There was a problem hiding this comment.
Curious about the change here -- we did intentionally move away from containerAppName .Name to .Name in #4434
There was a problem hiding this comment.
we did intentionally move away from containerAppName .Name to .Name in #4434
-
Do you mean change from
.NametocontainerAppName .Namein easy-init: allow for longer container app names #4434 ? -
In think the mistake (missing
containerAppName) is added in this PR: https://github.com/Azure/azure-dev/pull/4455/files
There was a problem hiding this comment.
I see. I think when #4455 was made, we also started adding upfront name validation in azd add (UI layer, not at the schema layer).
Keeping it as .Name instead of containerAppName .Name (which does the truncation) transformation may help with #4653, so I think .Name still looks better directionally. What do you think?
There was a problem hiding this comment.
How about doing like this:
- In current PR, keep using
containerAppName .Namebecause it can solve the problem appeared in the sample project for current PR: https://github.com/azure-javaee/azure-spring-boot-samples/blob/788cc9a14f3fa2bfa826b0e875ba6dd729726dfa/postgresql/spring-cloud-azure-starter-jdbc-postgresql/spring-cloud-azure-postgresql-sample/pom.xml#L39 - For [Issue] Failed to deploy app when app name too long or different app name has same long prefix #4653, we can fix it in another PR. In that PR, the same name prefix should be considered,
Improve func: appendToCommaSeperatedValues
| } | ||
| type propertyMergeFunc func(string, string) string | ||
|
|
||
| const azureProfileName = "azure" |
There was a problem hiding this comment.
what if in the user's application already have one azure profile?
| const placeholderPostgresHost = "${POSTGRES_HOST}" | ||
| const placeholderPostgresPort = "${POSTGRES_PORT}" | ||
| const placeholderPostgresDatabase = "${POSTGRES_DATABASE}" | ||
| const placeholderPostgresUsername = "${POSTGRES_USERNAME}" |
There was a problem hiding this comment.
These are the conventional env names that defined in azd.
There was a problem hiding this comment.
I mean these should be defined in a common place, instead of being defined in java
…um of 125 characters. (lll)
// G101 : Potential hardcoded credentials (gosec)
|
Hi, @saragluna , @weikanglim |
…o to app_init.go.
…ng-boot-properties-file-for-postgresql
Azure Dev CLI Install InstructionsInstall scriptsMacOS/Linux
bash: pwsh: WindowsPowerShell install MSI install Standalone Binary
MSI
Documentationlearn.microsoft.com documentationtitle: Azure Developer CLI reference
|
|
Hi, @saragluna , @weikanglim . |
| return false | ||
| } | ||
|
|
||
| type RawDependency struct { |
There was a problem hiding this comment.
If it's easier, we can just return the RawProject pom.xml representation and let the "app generation" part decide what to do with that information. I think we want to avoid having additional schema translations
| } | ||
|
|
||
| func updatePropertyFile(filePath string, newProperties []property, function propertyMergeFunc) error { | ||
| err := createFileIfNotExist(filePath) |
There was a problem hiding this comment.
Would it be simpler to just have a single function that opens the file, and just does a one-pass update?
I know that we've created a lot of functions here to attempt to break down the complexity. In doing so, they all "look right" individually, but if we zoom out to see the whole algorithm:
- If
createFileNotExistssucceeds, but we fail inreadProperties, we create an empty file - We also create the file again in
writeProperties
FWIW, this is related to what we had talked about creating too many functions.
| break | ||
| } | ||
| } | ||
| if !isSpringBootProject { |
There was a problem hiding this comment.
For non-spring boot projects, is there something needed for postgresql:postgresql?
| case "org.postgresql:postgresql", | ||
| "com.azure.spring:spring-cloud-azure-starter-jdbc-postgresql": |
There was a problem hiding this comment.
Is it possible for both these dependencies to exist at the same time, and if so -- do we only want to generate once?
|
Closing this PR because now SJAD team plan to create azure.yaml by AI-based method. Similarity, application.properties will be updated by AI-based method, too. |




1. Description
New feature: Update spring boot properties file for postgresql.
2. Try this feature
Link to sample project: https://github.com/azure-javaee/azure-spring-boot-samples/blob/788cc9a14f3fa2bfa826b0e875ba6dd729726dfa/postgresql/spring-cloud-azure-starter-jdbc-postgresql/spring-cloud-azure-postgresql-sample/pom.xml#L39
Screenshot before running
azd init:azd init:todos in current PR, my current plan is do them after current PR merged.