Open vy opened 3 years ago
Do you think it might be a bit misleading to call it emulator-url
since we don't really have an emulator for Cloud SQL?
What about just detecting if spring.datasource.url
was provided, and effectively disabling CloudSqlEnvironmentPostProcessor
based on that?
I was also in doubt of using emulator-url
due to the same concerns. Though wanted to keep the footprint similar to the one in Pub/Sub. Disabling CloudSqlEnvironmentPostProcessor
if spring.datasource.url
present sounds like a better approach. That said, I need to admit I am not sure if this might have some unwanted consequences. Thinking out loud... What if src/main
has both spring.datasource.url
and spring.cloud.gcp.sql
configurations providing two DataSource
s: one pointing to a direct instance and one pointing to a GCP instance, respectively? Your proposal will not introduce a backward-incompatible change to this configuration, right?
We overwrite the spring.datasource.url
anyway in CloudSqlEnvironmentPostProcessor
. The only backwards incompatible behavior would be that we would stop overwriting it and potentially disable Cloud SQL config for those apps. So, it's still something we need to consider.
When using
spring-cloud-gcp-starter-sql-{postgresql,mysql}
, one needs to explicitly disable these and point Spring to a new datasource inapplication-test.properties
:This experience can be improved by removing the need to explicitly disable Cloud SQL support during tests. In contrast, Pub/Sub only requires a single property, that is,
spring.cloud.gcp.pubsub.emulator-host
, to get going in tests. In the context of Cloud SQL, an alternative would be introduce a similarspring.cloud.gcp.sql.emulator-url
property: