Topics
Connection strings
Newt DB passes the data source name straight to PostgreSQL. PostgreSQL connection strings are documented in section 32.1.1 of the PostgreSQL manual, and they take two forms.
URL syntax
postgresql://[user[:password]@][netloc][:port][/dbname][?param1=value1&...]Keyword value syntax
host=localhost port=5432 dbname=mydb user=sally password=123456Defaults and empty strings
All of the parameters have defaults and may be excluded. An empty string is just an application of the keyword value syntax with no parameters specified. That is why the examples in the guides can call newt.db.connection('') and reach a local default database.
The full list of parameters is in the PostgreSQL connection string documentation.
Avoid passwords in strings
To avoid including passwords in connection strings, you can use a PostgreSQL password file. The file keeps the credential out of source control and out of process listings. The PostgreSQL password file documentation explains the location, format and permissions it expects.
Same string, three places. A connection string can be passed to newt.db.connection, placed in a newt configuration element, or used with the updater and follow tools. The text configuration guide shows the configuration file form.