Skip to content

Commit

Permalink
Delete password check when using managed identity as auth type. Becau…
Browse files Browse the repository at this point in the history
…se the configured password will be ignored without and error. (#65)
  • Loading branch information
rujche authored Dec 4, 2024
1 parent 529e450 commit 6d96a35
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 18 deletions.
1 change: 0 additions & 1 deletion cli/azd/internal/appdetect/appdetect.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,6 @@ type Metadata struct {
ContainsDependencySpringCloudAzureStarter bool
ContainsDependencySpringCloudAzureStarterJdbcPostgresql bool
ContainsDependencySpringCloudAzureStarterJdbcMysql bool
ContainsPropertySpringDatasourcePassword bool
ContainsDependencySpringCloudEurekaServer bool
ContainsDependencySpringCloudEurekaClient bool
ContainsDependencySpringCloudConfigServer bool
Expand Down
9 changes: 0 additions & 9 deletions cli/azd/internal/appdetect/spring_boot.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,6 @@ func detectMetadata(azdProject *Project, springBootProject *SpringBootProject) {
detectDependencySpringCloudAzureStarterJdbcMysql(azdProject, springBootProject)
detectDependencySpringCloudEureka(azdProject, springBootProject)
detectDependencySpringCloudConfig(azdProject, springBootProject)
detectPropertySpringDatasourcePassword(azdProject, springBootProject)
detectPropertySpringApplicationName(azdProject, springBootProject)
}

Expand Down Expand Up @@ -286,14 +285,6 @@ func detectDependencySpringCloudAzureStarterJdbcMysql(azdProject *Project, sprin
}
}

func detectPropertySpringDatasourcePassword(azdProject *Project, springBootProject *SpringBootProject) {
var targetProperty = "spring.datasource.password"
if _, ok := springBootProject.applicationProperties[targetProperty]; ok {
azdProject.Metadata.ContainsPropertySpringDatasourcePassword = true
logMetadataUpdated("ContainsPropertySpringDatasourcePassword = true")
}
}

func detectPropertySpringApplicationName(azdProject *Project, springBootProject *SpringBootProject) {
var targetSpringAppName = "spring.application.name"
if appName, ok := springBootProject.applicationProperties[targetSpringAppName]; ok {
Expand Down
9 changes: 1 addition & 8 deletions cli/azd/internal/repository/app_init.go
Original file line number Diff line number Diff line change
Expand Up @@ -807,9 +807,7 @@ func checkPasswordlessConfigurationAndContinueProvision(database appdetect.Datab
return true, nil
}
for i, prj := range detect.Services {
if prj.Language == appdetect.Java &&
(!prj.Metadata.ContainsDependencySpringCloudAzureStarter ||
prj.Metadata.ContainsPropertySpringDatasourcePassword) {
if prj.Language == appdetect.Java && !prj.Metadata.ContainsDependencySpringCloudAzureStarter {
message := fmt.Sprintf("You selected %s as auth type for %s.",
internal.AuthTypeUserAssignedManagedIdentity, database)
if database == appdetect.DbPostgres && !prj.Metadata.ContainsDependencySpringCloudAzureStarterJdbcPostgresql {
Expand All @@ -822,11 +820,6 @@ func checkPasswordlessConfigurationAndContinueProvision(database appdetect.Datab
"'com.azure.spring:spring-cloud-azure-starter-jdbc-mysql'. "+
"But this dependency is not found in your project: %s.", message, prj.Path)
}
if prj.Metadata.ContainsPropertySpringDatasourcePassword {
message = fmt.Sprintf("%s This property should be deleted: "+
"'spring.datasource.password'. "+
"But this property is found in your project: %s.", message, prj.Path)
}
continueOption, err := console.Select(ctx, input.ConsoleOptions{
Message: fmt.Sprintf("%s Select an option:", message),
Options: []string{
Expand Down

0 comments on commit 6d96a35

Please sign in to comment.