implement test changes regarding database

also added .env for database connection details (used by sqlx)
This commit is contained in:
Nick Bland
2021-11-07 00:23:49 +10:00
parent 782796486e
commit 6db0a7bc86
3 changed files with 27 additions and 0 deletions
+9
View File
@@ -22,4 +22,13 @@ pub fn get_configuration() -> Result<Settings, config::ConfigError> {
// Try convert into Settings type
settings.try_into()
}
impl DatabaseSettings {
pub fn connection_string(&self) -> String {
format!(
"postgres://{}:{}@{}:{}/{}",
self.username, self.password, self.host, self.port, self.database_name
)
}
}