小编J D*_*ont的帖子

Google Cloud SQL 上的 PostgREST:unix 套接字 URI 格式?

有谁有使用 PostgREST 和 Cloud SQL 的经验吗?

我的 SQL 实例已准备好开放访问 (0.0.0.0/0),我可以使用云代理应用程序通过本地 PostGREST 访问它。

现在我想从同一个项目的实例运行 Postgrest,但我找不到支持 Cloud SQL 格式的 Postgrest URI 格式,因为 Google SQL Cloud 只使用像 /cloudsql/INSTANCE_CONNECTION_NAME

配置 1

db-uri = "postgres://postgres:password@/unix(/cloudsql/INSTANCE_CONNECTION_NAME)/mydatabase"
db-schema = "api"
jwt-secret = "OOcJ7VoSY1mXqod4MKtb9WCCwt9erJkRQ2tzYmLb4Xe="
db-anon-role = "web_anon"
server-port=3000
Run Code Online (Sandbox Code Playgroud)

退货 {"details":"could not translate host name \"unix(\" to address: Unknown host\n","code":"","message":"Database connection error"}

配置 2

db-uri = "postgres://postgres:password@/mydatabase?unix_socket=/cloudsql/INSTANCE_CONNECTION_NAME"
db-schema = "api"
jwt-secret = "OOcJ7VoSY1mXqod4MKtb9WCCwt9erJkRQ2tzYmLb4Xe="
db-anon-role = "web_anon"
server-port=3000
Run Code Online (Sandbox Code Playgroud)

解析器拒绝问号 {"details":"invalid URI query parameter: \"unix_socket\"\n","code":"","message":"Database connection error"}

配置 3

db-uri = …
Run Code Online (Sandbox Code Playgroud)

unix-socket google-cloud-sql postgrest

6
推荐指数
1
解决办法
1066
查看次数

标签 统计

google-cloud-sql ×1

postgrest ×1

unix-socket ×1