-
Notifications
You must be signed in to change notification settings - Fork 6
chore: added ods version compatibility check #41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
5fc7a00
5d5aa99
1ad8ff7
8801416
e336899
150380a
c2a7c85
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,6 +29,8 @@ use tokio::{ | |
| }; | ||
| use uuid::Uuid; | ||
|
|
||
| pub const REQ_ODS_VERSION: &str = ">=0.39.0"; | ||
|
|
||
| const UPLOAD_LIMIT_BYTES: usize = 250 * 1024 * 1024; | ||
| const MEMORY_LIMIT_BYTES: usize = 10 * 1024 * 1024; | ||
|
|
||
|
|
@@ -120,11 +122,22 @@ async fn main() { | |
| .parse::<u64>() | ||
| .expect("UI_PORT format"); | ||
|
|
||
| let ods_socket_path = std::env::var("SOCKET_PATH").expect("env SOCKET_PATH is missing"); | ||
| fs::exists(&ods_socket_path).unwrap_or_else(|_| { | ||
| panic!( | ||
| "omnect device service socket file {} does not exist", | ||
| &ods_socket_path | ||
| ) | ||
| }); | ||
|
Comment on lines
+126
to
+131
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IMHO we don't need this check. There might be cases where the unix domain socket exists and is deleted later on. We should instead ensure, that the open call to the unix domain socket does not attempt to create a file if the file does not exist, and handle the error on opening.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, I just saw, that this is pre-existing code. Still: just drop the check :)
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @empwilli what do you mean by "...attempt to create a file..."? |
||
| let version_check_result = common::check_and_store_ods_version(&ods_socket_path) | ||
| .await | ||
| .expect("failed to check and store ods version"); | ||
|
|
||
| CryptoProvider::install_default(default_provider()).expect("failed to install crypto provider"); | ||
|
|
||
| certificate::create_module_certificate(&cert_path!(), &key_path!()) | ||
| .await | ||
| .expect("Failed to create module certificate"); | ||
| .expect("failed to create module certificate"); | ||
|
|
||
| let mut tls_certs = | ||
| std::io::BufReader::new(std::fs::File::open(cert_path!()).expect("read certs_file")); | ||
|
|
@@ -166,19 +179,11 @@ async fn main() { | |
| ¢rifugo_http_server_port!(), | ||
| ); | ||
|
|
||
| let ods_socket_path = std::env::var("SOCKET_PATH").expect("env SOCKET_PATH is missing"); | ||
| let index_html = | ||
| std::fs::canonicalize("static/index.html").expect("static/index.html not found"); | ||
|
|
||
| let tenant = std::env::var("TENANT").expect("env TENANT is missing"); | ||
|
|
||
| fs::exists(&ods_socket_path).unwrap_or_else(|_| { | ||
| panic!( | ||
| "omnect device service socket file {} does not exist", | ||
| &ods_socket_path | ||
| ) | ||
| }); | ||
|
|
||
| fs::exists(&update_os_path!()) | ||
| .unwrap_or_else(|_| panic!("path {} for os update does not exist", &update_os_path!())); | ||
|
|
||
|
|
@@ -194,6 +199,7 @@ async fn main() { | |
| index_html, | ||
| keycloak_public_key_url: keycloak_url!(), | ||
| tenant, | ||
| version_check_result, | ||
| }; | ||
|
|
||
| let session_key = Key::generate(); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.