Skip to content

Configuration options

bruno- edited this page Nov 16, 2014 · 11 revisions

This page is not a required read. Consult it only if you're looking for something specific.

This plugin should just work with no configuration whatsoever. However, configuration is possible. Put all your configs in capistrano stage files i.e. config/deploy/production.rb.

Here's the list of options and the defaults for each option:

  • set :pg_database
    Name of the database for your app. Defaults to #{application}_#{stage}, example: myface_production.

  • set :pg_user
    Name of the database user. Defaults to whatever is set for pg_database option.

  • set :pg_password
    Password for the database user. By default this option is not set and a new random password is generated each time you create a new database.
    If you set this option to "some_secure_password" - that will be the db user's password. Keep in mind that having a hardcoded password in deploy.rb (or anywhere in version control) is a bad practice.
    I recommend sticking to the default and generating a new secure and random password each time a db user is generated. That way you don't have to worry about it or try to remember it.

  • set :pg_ask_for_password
    Default false. Set this option to true if you want to be prompted for the password when database user is created. This is safer than setting the password via pg_password. The downside is you have to choose and remember yet another fricking password.
    pg_password option has precedence. If it is set, pg_ask_for_password is ignored.

  • set :pg_system_user
    Default postgres. Set this option to the user that owns the postgres process on your system. Normally the default is fine, but for instance on FreeBSD the default prostgres user is pgsql.

  • set :pg_system_db
    Default postgres. Set this if the system database don't have the standard name. Usually there should be no reason to change this from the default.

  • set :pg_extensions
    Defaults to empty array []. If for example, you want to install "hstore" extension, just add add it to the array with set :pg_extension, ["hstore"].

  • set :pg_use_hstore (deprecated, use pg_extensions option)
    Default false. If true, the postgresql:add_hstore task is executed and the hstore extension is added to :pg_database.

database.yml template-only settings:

  • set :pg_env
    DB environment. Defaults to the value of rails_env option. If rails_env is not set, it defaults to stage option.

  • set :pg_pool
    Pool config in database.yml template. Defaults to 5.

  • set :pg_host
    hostname config in database.yml template. Defaults to localhost.

  • set :pg_encoding
    encoding config in database.yml template. Defaults to unicode.

Clone this wiki locally