-
Notifications
You must be signed in to change notification settings - Fork 1
Cli refactor #43
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
base: main
Are you sure you want to change the base?
Cli refactor #43
Conversation
ENTRYPOINT [ "/usr/local/bin/samply" ] | ||
CMD [ "dic" ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if we actually want to include this CMD
instruction here it preserves backwards compatibility with the no ttp usecase but its probably not worth it as the other ttp use cases have require the linked bridgehead PR anyway
pub static CLIENT: LazyLock<&Client> = LazyLock::new(|| INNER_CLIENT.get().expect("Client should be initialized before use")); | ||
static INNER_CLIENT: OnceLock<Client> = OnceLock::new(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is rather hacky but quite clever I think because we don't have the whole config as a global anymore but really want to share a client everywhere that is configured correctly and dont want to write .get().unwrap()
everywhere we just do it once here and store the ref to the finished client.
#[derive(Debug, Clone)] | ||
pub struct DicAppState { | ||
pub database_pool: Pool<Sqlite>, | ||
pub config: &'static DicConfig, | ||
pub request_server: &'static FhirServer, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again because config is not globaly anymore we need to share more data with axum. So we include everything in this struct
Subcommand name of |
once_cell
withLazyLock
bridgehead PR samply/bridgehead#319