class Avram::Credentials

Defined in:

avram/credentials.cr

Constructors

Class Method Summary

Instance Method Summary

Instance methods inherited from class Object

blank_for_validates_required? : Bool blank_for_validates_required?

Constructor Detail

def self.new(database : String, hostname : String | Nil = nil, username : String | Nil = nil, password : String | Nil = nil, port : Int32 | Nil = nil, query : String | Nil = nil) #

[View source]
def self.parse(connection_url : String) : Credentials #

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

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

[View source]
def self.void : Credentials #

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


[View source]

Class Method Detail

def self.parse?(connection_url : String | Nil) : Credentials | Nil #

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

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

[View source]

Instance Method Detail

def connection_string : String #

This is the full connection string used to connect to the PostgreSQL server.


[View source]
def database : String #

The name of the database you want to connect to


[View source]
def hostname : String | Nil #

[View source]
def password : String | Nil #

[View source]
def port : Int32 | Nil #

[View source]
def query : String | Nil #

[View source]
def url : String #

[View source]
def url_without_query_params : String #

Returns the postgres connection string without any query params.


[View source]
def username : String | Nil #

[View source]