Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fn env(expression: &str) -> Option<String> {
- if let Ok(f) = File::open("/var/www/config/global/.env") {
- let file = BufReader::new(f);
- let regex = Regex::new(expression).unwrap();
- let mut result: Option<String> = None;
- for line in file.lines() {
- let l = line.unwrap();
- if regex.is_match(&l) {
- for cap in regex.captures_iter(&l) {
- result = Some(cap[1].to_string());
- }
- }
- }
- result
- }
- None
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement