@@ -5,6 +5,7 @@ use url::Url;
5
5
6
6
use crate :: Env ;
7
7
use crate :: rate_limiter:: { LimitedAction , RateLimiterConfig } ;
8
+ use crate :: util:: gh_token_encryption:: GitHubTokenEncryption ;
8
9
9
10
use super :: base:: Base ;
10
11
use super :: database_pools:: DatabasePools ;
@@ -42,6 +43,7 @@ pub struct Server {
42
43
pub session_key : cookie:: Key ,
43
44
pub gh_client_id : ClientId ,
44
45
pub gh_client_secret : ClientSecret ,
46
+ pub gh_token_encryption : GitHubTokenEncryption ,
45
47
pub max_upload_size : u32 ,
46
48
pub max_unpack_size : u64 ,
47
49
pub max_dependencies : usize ,
@@ -106,6 +108,7 @@ impl Server {
106
108
/// - `SESSION_KEY`: The key used to sign and encrypt session cookies.
107
109
/// - `GH_CLIENT_ID`: The client ID of the associated GitHub application.
108
110
/// - `GH_CLIENT_SECRET`: The client secret of the associated GitHub application.
111
+ /// - `GITHUB_TOKEN_ENCRYPTION_KEY`: Key for encrypting GitHub access tokens (64 hex characters).
109
112
/// - `BLOCKED_TRAFFIC`: A list of headers and environment variables to use for blocking
110
113
/// traffic. See the `block_traffic` module for more documentation.
111
114
/// - `DOWNLOADS_PERSIST_INTERVAL_MS`: how frequent to persist download counts (in ms).
@@ -205,6 +208,7 @@ impl Server {
205
208
session_key : cookie:: Key :: derive_from ( required_var ( "SESSION_KEY" ) ?. as_bytes ( ) ) ,
206
209
gh_client_id : ClientId :: new ( required_var ( "GH_CLIENT_ID" ) ?) ,
207
210
gh_client_secret : ClientSecret :: new ( required_var ( "GH_CLIENT_SECRET" ) ?) ,
211
+ gh_token_encryption : GitHubTokenEncryption :: from_environment ( ) ?,
208
212
max_upload_size : 10 * 1024 * 1024 , // 10 MB default file upload size limit
209
213
max_unpack_size : 512 * 1024 * 1024 , // 512 MB max when decompressed
210
214
max_dependencies : DEFAULT_MAX_DEPENDENCIES ,
0 commit comments