(path: &Path)
| 183 | } |
| 184 | |
| 185 | pub fn read_token(path: &Path) -> io::Result<Option<String>> { |
| 186 | match fs::read_to_string(path) { |
| 187 | Ok(contents) => { |
| 188 | let token = contents.trim(); |
| 189 | if token.is_empty() { |
| 190 | Ok(None) |
| 191 | } else { |
| 192 | Ok(Some(token.to_string())) |
| 193 | } |
| 194 | } |
| 195 | Err(error) if error.kind() == io::ErrorKind::NotFound => Ok(None), |
| 196 | Err(error) => Err(error), |
| 197 | } |
| 198 | } |
| 199 | |
| 200 | #[must_use] |
| 201 | pub fn upstream_proxy_ws_url(base_url: &str) -> String { |