-
Notifications
You must be signed in to change notification settings - Fork 0
Replace unixSocketPath with ipTypes for Cloud SQL TCP #402
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -205,7 +205,7 @@ private void configureCloudSqlProperties(HikariConfig config, String jdbcUrl) { | |
| } | ||
|
|
||
| config.addDataSourceProperty("socketFactory", "com.google.cloud.sql.postgres.SocketFactory"); | ||
| config.addDataSourceProperty("unixSocketPath", instanceUnixSocket); | ||
| config.addDataSourceProperty("ipTypes", "PUBLIC,PRIVATE"); | ||
| String cloudSqlInstance = extractCloudSqlInstance(instanceUnixSocket); | ||
|
||
| if (isNotBlank(cloudSqlInstance)) { | ||
| config.addDataSourceProperty("cloudSqlInstance", cloudSqlInstance); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -75,7 +75,7 @@ object DatabaseFactory { | |
| } | ||
|
|
||
| hikariConfig.addDataSourceProperty("socketFactory", CLOUD_SQL_SOCKET_FACTORY) | ||
| hikariConfig.addDataSourceProperty("unixSocketPath", config.host) | ||
| hikariConfig.addDataSourceProperty("ipTypes", "PUBLIC,PRIVATE") | ||
|
||
| val cloudSqlInstance = extractCloudSqlInstance(config.host) | ||
| if (cloudSqlInstance != null) { | ||
| hikariConfig.addDataSourceProperty("cloudSqlInstance", cloudSqlInstance) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The variable
instanceUnixSocket(line 202) is still being used but is now misleading since the code uses TCP connections withipTypesinstead of Unix sockets. The variable should be renamed to reflect its current purpose of identifying the Cloud SQL instance path. Additionally, this change fromunixSocketPathtoipTypeswill break existing tests in DataSourceConfigTest.java (lines 97 and 123) that assert the presence ofunixSocketPathin data source properties. The tests need to be updated to check foripTypeswith value "PUBLIC,PRIVATE" instead.