rabbitmqconfig: accept SSL option

This commit is contained in:
Graham Christensen 2017-11-10 18:34:36 -05:00
parent ea8904e8f7
commit f42dd6bb4c
No known key found for this signature in database
GPG key ID: ACA1C1D120C83D5C

View file

@ -12,6 +12,7 @@ pub struct Config {
#[derive(Serialize, Deserialize, Debug)] #[derive(Serialize, Deserialize, Debug)]
pub struct RabbitMQConfig { pub struct RabbitMQConfig {
pub ssl: bool,
pub host: String, pub host: String,
pub username: String, pub username: String,
pub password: String, pub password: String,
@ -31,7 +32,9 @@ pub struct CheckoutConfig {
impl RabbitMQConfig { impl RabbitMQConfig {
pub fn as_uri(&self) -> String{ pub fn as_uri(&self) -> String{
return format!("amqps://{}:{}@{}//", self.username, self.password, self.host); return format!("{}://{}:{}@{}//",
if self.ssl { "amqps" } else { "amqp" },
self.username, self.password, self.host);
} }
} }