Skip to content

Commit 95d5321

Browse files
mpeypersvc-squareup-copybara
authored andcommitted
The /proc/1/cgroup check to set the server_hostname when
running under docker is not working in all cases. We verified this by exec-ing into our running container and checking the proc file contents: ``` ❯ docker exec -it our-container sh # on host $ cat /proc/1/cgroup # in container 0::/ ``` This change introduced a a `VITESS_HOST` variable similarly to the `MYSQL_HOST` variable used for standard MySQL connections. I've left the original fallback in this case in case anything else was relying on it. Our use case only calls for connecting to VITESS, but I suspect other DB types could suffer from the same issue. GitOrigin-RevId: 83d56771222b1a8601fcd4e8cb3b3849dbebe2ce
1 parent ee8a451 commit 95d5321

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

misk-jdbc/src/main/kotlin/misk/jdbc/DataSourceConfig.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ data class DataSourceConfig @JvmOverloads constructor(
168168
DataSourceType.VITESS_MYSQL -> {
169169
copy(
170170
port = port ?: 27003,
171-
host = host ?: server_hostname,
171+
host = host ?: System.getenv("VITESS_HOST") ?: server_hostname,
172172
database = database ?: "@master"
173173
)
174174
}

0 commit comments

Comments
 (0)