aboutsummaryrefslogtreecommitdiffstats
path: root/rs/git-lfs-authenticate/src
diff options
context:
space:
mode:
Diffstat (limited to 'rs/git-lfs-authenticate/src')
-rw-r--r--rs/git-lfs-authenticate/src/main.rs15
1 files changed, 7 insertions, 8 deletions
diff --git a/rs/git-lfs-authenticate/src/main.rs b/rs/git-lfs-authenticate/src/main.rs
index db95923..36d7818 100644
--- a/rs/git-lfs-authenticate/src/main.rs
+++ b/rs/git-lfs-authenticate/src/main.rs
@@ -148,30 +148,30 @@ struct Config {
148 148
149#[derive(Debug, Eq, PartialEq, Copy, Clone)] 149#[derive(Debug, Eq, PartialEq, Copy, Clone)]
150enum LoadConfigError { 150enum LoadConfigError {
151 BaseUrlMissing, 151 BaseUrlNotProvided,
152 BaseUrlSlashSuffixMissing, 152 BaseUrlSlashSuffixMissing,
153 KeyPathMissing, 153 KeyPathNotProvided,
154} 154}
155 155
156impl fmt::Display for LoadConfigError { 156impl fmt::Display for LoadConfigError {
157 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { 157 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
158 match self { 158 match self {
159 Self::BaseUrlMissing => write!(f, "base URL not provided"), 159 Self::BaseUrlNotProvided => write!(f, "base URL not provided"),
160 Self::BaseUrlSlashSuffixMissing => write!(f, "base URL does not end with slash"), 160 Self::BaseUrlSlashSuffixMissing => write!(f, "base URL does not end with slash"),
161 Self::KeyPathMissing => write!(f, "key path not provided"), 161 Self::KeyPathNotProvided => write!(f, "key path not provided"),
162 } 162 }
163 } 163 }
164} 164}
165 165
166fn load_config() -> Result<Config, LoadConfigError> { 166fn load_config() -> Result<Config, LoadConfigError> {
167 let Ok(href_base) = std::env::var("GITOLFS3_HREF_BASE") else { 167 let Ok(href_base) = std::env::var("GITOLFS3_HREF_BASE") else {
168 return Err(LoadConfigError::BaseUrlMissing); 168 return Err(LoadConfigError::BaseUrlNotProvided);
169 }; 169 };
170 if !href_base.ends_with('/') { 170 if !href_base.ends_with('/') {
171 return Err(LoadConfigError::BaseUrlSlashSuffixMissing); 171 return Err(LoadConfigError::BaseUrlSlashSuffixMissing);
172 } 172 }
173 let Ok(key_path) = std::env::var("GITOLFS3_KEY_PATH") else { 173 let Ok(key_path) = std::env::var("GITOLFS3_KEY_PATH") else {
174 return Err(LoadConfigError::KeyPathMissing); 174 return Err(LoadConfigError::KeyPathNotProvided);
175 }; 175 };
176 Ok(Config { 176 Ok(Config {
177 href_base, 177 href_base,
@@ -213,10 +213,9 @@ fn main() -> ExitCode {
213 let expires_at = Utc::now() + Duration::from_secs(5 * 60); 213 let expires_at = Utc::now() + Duration::from_secs(5 * 60);
214 let Some(tag) = common::generate_tag( 214 let Some(tag) = common::generate_tag(
215 common::Claims { 215 common::Claims {
216 auth_type: common::AuthType::GitLfsAuthenticate, 216 specific_claims: common::SpecificClaims::BatchApi(operation),
217 repo_path: &repo_name, 217 repo_path: &repo_name,
218 expires_at, 218 expires_at,
219 operation,
220 }, 219 },
221 key, 220 key,
222 ) else { 221 ) else {