忽略配置主机名数据库

时间:2019-06-11 08:42:57

标签: elixir phoenix-framework

我具有以下数据库配置:

 # Configure your database
config :phoenix_chat, PhoenixChat.Repo,
  username: "postgres",
  password: "postgres",
  database: "postgres",
  hostname: "localhost",
  pool_size: 10

我在尝试连接到postgres时遇到问题,因此我决定使用show_sensitive_data_on_connection_error对其进行调试,并看到了以下内容:

** (KeyError) key :database not found in: [types: Postgrex.DefaultTypes, repo: PhoenixChat.Repo, port: 5432, hostname: "db", username: "postgres", telemetry_prefix: [:phoenix_chat, :repo], otp_app: :phoenix_chat, timeout: 15000, pool_size: 10, show_sensitive_data_on_connection_error: true, pool: DBConnection.ConnectionPool]
    (elixir) lib/keyword.ex:389: Keyword.fetch!/2
    (postgrex) lib/postgrex/protocol.ex:90: Postgrex.Protocol.connect/1
    (db_connection) lib/db_connection/connection.ex:66: DBConnection.Connection.connect/2
    (connection) lib/connection.ex:622: Connection.enter_connect/5
    (stdlib) proc_lib.erl:249: :proc_lib.init_p_do_apply/3
Last message: nil
State: Postgrex.Protocol

如何使用主机名“ db”?我清楚地指定了主机名“ localhost”,并且在任何配置文件中的任何地方都没有定义任何主机名“ db”,这是默认位置吗?

0 个答案:

没有答案