Can Yesod's DB be configured with environment variables?

久未见 提交于 2019-12-13 02:58:37

问题


When I scaffold a new Yesod project and select e.g. PostgreSQL as the database, I get config/postgresql.yml that has the connection parameters. But I want to run my DB in one Docker container and the app in another, and link these via environment variables that contain the DB IP, port and whatnot.

How can I tell Yesod to connect to a database by using a bunch of environment variables for configuration?


回答1:


Yes, you can do this via the following environment variables:

    "PGHOST"
    "PGPORT"
    "PGUSER"
    "PGPASS"
    "PGDATABASE"


来源:https://stackoverflow.com/questions/25722740/can-yesods-db-be-configured-with-environment-variables

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!