Postgres utilities for use with nacelle.
This library creates a Postgres connection wrapped in a nacelle logger. The supplied initializer adds this connection into the nacelle service container under the key db
. The initializer will block until a ping succeeds.
func setup(processes nacelle.ProcessContainer, services nacelle.ServiceContainer) error {
processes.RegisterInitializer(pgutil.NewInitializer())
// additional setup
return nil
}
The default service behavior can be configured by the following environment variables.
Environment Variable | Required | Default | Description |
---|---|---|---|
DATABASE_URL | yes | The connection string of the remote database. | |
LOG_SQL_QUERIES | false | Whether or not to log parameterized SQL queries. |