class

Avram::Credentials

Inherits Reference < Object

Constructors

new(database : String, scheme : String = "postgres", hostname : String | Nil = nil, username : String | Nil = nil, password : String | Nil = nil, port : Int32 | Nil = nil, query : String | Nil = nil)
Source
new(uri : URI)
Source
parse(connection_url : String) : Credentials

Parse a DB connection string URL. This may come from an environment variable.

Avram::Credentials.parse(ENV["DB_URL"])
Source
void

Used when you need to configure credentials, but no database connection is made.

Source

Class methods

parse?(connection_url : String | Nil) : Credentials | Nil

Parse a DB connection string URL. This may come from an environment variable. Returns nil if no connection_url is provided.

Avram::Credentials.parse?(ENV["DB_URL"]?)
Source

Instance methods

connection_string

This is the connection string without the DB, or query added in. This is used for connecting to the database engine without connecting to a specific database. e.g. postgres://user:pass@host:1234

Source
database

The name of the database you want to connect to

Source
hostname
Source
password
Source
port
Source
protocol
Source
query
Source
url

This is the full URL including the database, querystring, etc... e.g. postgres://user:pass@host:1234/db?a=1

Source
url_without_query_params

Returns the connection string without any query params.

Source
username
Source