(&self)
| 71 | } |
| 72 | |
| 73 | pub fn get_mysql_url(&self) -> Option<String> { |
| 74 | self.mysql.as_ref().and_then(|c| { |
| 75 | c.url.clone().map(Into::into).or_else(|| { |
| 76 | match (&c.host, &c.port, &c.user, &c.password, &c.database) { |
| 77 | (Some(host), Some(port), Some(user), Some(password), Some(database)) => { |
| 78 | Some(format!( |
| 79 | "mysql://{}:{}@{}:{}/{}", |
| 80 | user, password, host, port, database |
| 81 | )) |
| 82 | } |
| 83 | _ => None, |
| 84 | } |
| 85 | }) |
| 86 | }) |
| 87 | } |
| 88 | |
| 89 | pub fn get_redis_url(&self) -> Option<String> { |
| 90 | self.redis.as_ref().and_then(|c| { |