Skip to main content

haste_server/
lib.rs

1pub mod auth_n;
2mod extract;
3pub mod fhir_client;
4mod fhir_http;
5pub mod load_artifacts;
6mod mcp;
7mod middleware;
8mod openapi;
9mod route_path;
10pub mod server;
11pub mod services;
12mod static_assets;
13pub mod tenants;
14mod ui;
15
16pub enum ServerEnvironmentVariables {
17    AllowArtifactMutations,
18    // Used for JWT
19    CertificationDir,
20    // Main repo config
21    DataBaseURL,
22    // Search variable config.
23    ElasticSearchURL,
24    ElasticSearchUsername,
25    ElasticSearchPassword,
26    // Main root where the FHIR Server is hosted.
27    APIURI,
28    // Where to redirect for hardcoded admin app.
29    AdminAppRedirectURI,
30    // Email
31    SendGridAPIKey,
32    EmailFromAddress,
33    // Data Limits
34    MaxRequestBodySize,
35    RateLimitSubscriptions,
36    RateLimitWindowInSeconds,
37    RateLimitOperationPoints,
38}
39
40impl From<ServerEnvironmentVariables> for String {
41    fn from(value: ServerEnvironmentVariables) -> Self {
42        match value {
43            ServerEnvironmentVariables::CertificationDir => "CERTIFICATION_DIR".to_string(),
44            ServerEnvironmentVariables::AllowArtifactMutations => {
45                "ALLOW_ARTIFACT_MUTATIONS".to_string()
46            }
47            ServerEnvironmentVariables::DataBaseURL => "DATABASE_URL".to_string(),
48            ServerEnvironmentVariables::ElasticSearchURL => "ELASTICSEARCH_URL".to_string(),
49            ServerEnvironmentVariables::ElasticSearchUsername => {
50                "ELASTICSEARCH_USERNAME".to_string()
51            }
52            ServerEnvironmentVariables::ElasticSearchPassword => {
53                "ELASTICSEARCH_PASSWORD".to_string()
54            }
55            ServerEnvironmentVariables::APIURI => "API_URI".to_string(),
56            ServerEnvironmentVariables::AdminAppRedirectURI => "ADMIN_APP_REDIRECT_URI".to_string(),
57            ServerEnvironmentVariables::SendGridAPIKey => "SG_API_KEY".to_string(),
58            ServerEnvironmentVariables::EmailFromAddress => "EMAIL_FROM".to_string(),
59            ServerEnvironmentVariables::MaxRequestBodySize => "MAX_REQUEST_BODY_SIZE".to_string(),
60            ServerEnvironmentVariables::RateLimitSubscriptions => {
61                "RATE_LIMIT_SUBSCRIPTIONS".to_string()
62            }
63
64            ServerEnvironmentVariables::RateLimitWindowInSeconds => {
65                "RATE_LIMIT_WINDOW_IN_SECONDS".to_string()
66            }
67
68            ServerEnvironmentVariables::RateLimitOperationPoints => {
69                "RATE_LIMIT_OPERATION_POINTS".to_string()
70            }
71        }
72    }
73}