`initialize': the scheme postgres does not accept registry part: postgres:@ (or bad hostname?) (URI::InvalidURIError) with Docker

后端 未结 3 981
Happy的楠姐
Happy的楠姐 2021-02-13 12:38

I\'m using Rails with Postgres DB Docker container attached. It looks like I\'m getting below error when I run rails c:

/usr/local/rvm/rubies/ruby-2         


        
3条回答
  •  既然无缘
    2021-02-13 13:24

    From the "Configuring Rails Applications" guide, it would appear that DATABASE_URL is used for configuring database access. Another way to configure database access is the presence of the file config/database.yml. Trying to use both methods to configure database access causes the issue you are facing.

    if your password contains unsafe characters

    Connection string used for DATABASE_URL cannot contain special characters (anything other than [a-zA-Z0-9_~-\.], e.g. @ is a common one to mess up). Solution is to url-encode.

    if you are using dokku

    • https://github.com/Kloadut/dokku-pg-plugin/issues/76 - Host and Port information are missing
    • https://github.com/dokku/dokku-postgres/issues/28 - Rewritten link command generates invalid host

    if you are using pghero

    • https://github.com/ankane/pghero - Fail to start if password contain @

提交回复
热议问题