@@ -57,12 +57,26 @@ pub struct Config {
5757 // Content Security Policy
5858 pub ( crate ) csp_report_only : bool ,
5959
60- // Cache-Control header
60+ // Cache-Control header, for versioned URLs.
6161 // If both are absent, don't generate the header. If only one is present,
6262 // generate just that directive. Values are in seconds.
6363 pub ( crate ) cache_control_stale_while_revalidate : Option < u32 > ,
6464 pub ( crate ) cache_control_max_age : Option < u32 > ,
6565
66+ // Cache-Control header, for /latest/ URLs.
67+ // Same conditions as above apply.
68+ pub ( crate ) cache_control_stale_while_revalidate_latest : Option < u32 > ,
69+ pub ( crate ) cache_control_max_age_latest : Option < u32 > ,
70+
71+ // CloudFront distribution ID for the web server.
72+ // Will be used for invalidation-requests.
73+ pub ( crate ) cloudfront_distribution_id_web : Option < String > ,
74+
75+ // when invalidating, either
76+ // * invalidate the whole crate path (`/krate/*`)
77+ // * invalidate only the `/latest/` url
78+ pub ( crate ) cloudfront_only_invalidate_latest : bool ,
79+
6680 // Build params
6781 pub ( crate ) build_attempts : u16 ,
6882 pub ( crate ) rustwide_workspace : PathBuf ,
@@ -141,6 +155,15 @@ impl Config {
141155 ) ?,
142156 cache_control_max_age : maybe_env ( "CACHE_CONTROL_MAX_AGE" ) ?,
143157
158+ cache_control_stale_while_revalidate_latest : maybe_env (
159+ "CACHE_CONTROL_STALE_WHILE_REVALIDATE_LATEST" ,
160+ ) ?,
161+ cache_control_max_age_latest : maybe_env ( "CACHE_CONTROL_MAX_AGE_LATEST" ) ?,
162+
163+ cloudfront_distribution_id_web : maybe_env ( "CLOUDFRONT_DISTRIBUTION_ID_WEB" ) ?,
164+
165+ cloudfront_only_invalidate_latest : env ( "CLOUDFRONT_ONLY_INVALIDATE_LATEST" , false ) ?,
166+
144167 local_archive_cache_path : env (
145168 "DOCSRS_ARCHIVE_INDEX_CACHE_PATH" ,
146169 prefix. join ( "archive_cache" ) ,
0 commit comments