sql-proxy
sql-proxy copied to clipboard
Enhance listening host configuration in cmd/sql-proxy-client via PLANETSCALE_LISTENING_HOST environment variable
Summary
This PR enhances the flexibility of setting the listening host in cmd/sql-proxy-client/main.go. It allows the host to be configured via an environment variable, PLANETSCALE_LISTENING_HOST
, while maintaining "127.0.0.1" as the default value if the variable is not set.
Changes
Modified the host flag to dynamically fetch its value from the PLANETSCALE_LISTENING_HOST
environment variable, defaulting to "127.0.0.1" if the variable is not set.
Why
This change provides users with the ability to easily configure the listening host via an environment variable without losing the convenience of a default value.
How to Test
- Do not set the environment variable
PLANETSCALE_LISTENING_HOST
and run the SQL proxy client. Verify that it listens on the default "127.0.0.1" host. - Set the environment variable
PLANETSCALE_LISTENING_HOST
to a desired host. - Run the SQL proxy client.
- Verify that the client is listening on the host specified in the
PLANETSCALE_LISTENING_HOST
environment variable.
Maintainer:
@skottler, please have a look when you can.