load

Loads credentials from the given file

The file to load must have the appropriate format (see example below). One file can hold multiple credential entities, each consisting of a name and a set of variables.

load
(
string file
)

Throws

CredentialException if file is not formated as expected ErrnoException if file could not be opened.

Examples

[connection_name]
host = 127.0.0.1
port = 3306
user = MyUser
pwd = MyPassword
db = MyDatabase
Credential[] credentials = .load("./source/test.cred");
assert(credentials.length == 3);

assert(credentials.get("connection_name").connectionName == "connection_name");
assert(credentials.get("connection_name").host == "127.0.0.1");
assert(credentials.get("connection_name").port == 3306);
assert(credentials.get("connection_name").user == "MyUser");
assert(credentials.get("connection_name").pwd == "MyPassword");
assert(credentials.get("connection_name").db == "MyDatabase");
assert(credentials.get("connection_name").connectionString == "host=127.0.0.1;port=3306;user=MyUser;pwd=MyPassword;db=MyDatabase");

Meta

Authors

Martin Brzenska ' Licence: MIT