works on docker

This commit is contained in:
opentrade committed 2021-05-04 21:59:59 +08:00
1 parent ac258cb132
commit f432bba366
1 file changed
+4 -1
+4 -1
View File
@@ -38,7 +38,9 @@ pub fn check_lic(email: &str, version: &str) -> bool {
return false; return false;
} }
let machine = get_lic(); let is_docker = std::path::Path::new("/.dockerenv").exists();
let machine = if is_docker { "".to_owned() } else { get_lic() };
if !is_docker {
let path = Path::new(LICENSE_FILE); let path = Path::new(LICENSE_FILE);
if Path::is_file(&path) { if Path::is_file(&path) {
let contents = std::fs::read_to_string(&path).unwrap_or("".to_owned()); let contents = std::fs::read_to_string(&path).unwrap_or("".to_owned());
@@ -47,6 +49,7 @@ pub fn check_lic(email: &str, version: &str) -> bool {
return true; return true;
} }
} }
}
match check_email(machine.clone(), email.to_owned(), version.to_owned()) { match check_email(machine.clone(), email.to_owned(), version.to_owned()) {
Ok(v) => { Ok(v) => {