Commit 85abf0c 1 parent d14091e commit 85abf0c Copy full SHA for 85abf0c
File tree 2 files changed +21
-3
lines changed
2 files changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -8,16 +8,25 @@ use std::{env, path::PathBuf};
8
8
#[ derive( Parser ) ]
9
9
#[ command( version, about, long_about = None ) ]
10
10
pub struct Cli {
11
- /// The path to the configuration file.
11
+ /// The configuration file.
12
12
#[ arg(
13
13
short,
14
14
long,
15
- value_name = "FILE " ,
15
+ value_name = "PATH " ,
16
16
env = "HANKO_CONFIG" ,
17
17
default_value = default_config_path( )
18
18
) ]
19
19
pub config : PathBuf ,
20
20
21
+ /// The allowed signers file used by Git.
22
+ #[ arg(
23
+ long,
24
+ value_name = "PATH" ,
25
+ env = "HANKO_ALLOWED_SIGNERS" ,
26
+ default_value = git_allowed_signers_path( )
27
+ ) ]
28
+ pub allowed_signers : PathBuf ,
29
+
21
30
#[ command( flatten) ]
22
31
logging : Logging ,
23
32
@@ -66,6 +75,12 @@ fn default_config_path() -> Resettable<OsStr> {
66
75
}
67
76
}
68
77
78
+ /// The path to the allowed signers file as configured within Git.
79
+ fn git_allowed_signers_path ( ) -> Resettable < OsStr > {
80
+ // TODO: Get value from Git config.
81
+ Resettable :: Value ( "~/.config/git/allowed_signers" . into ( ) )
82
+ }
83
+
69
84
#[ cfg( test) ]
70
85
mod tests {
71
86
use super :: * ;
Original file line number Diff line number Diff line change @@ -4,11 +4,12 @@ use figment::{
4
4
Figment ,
5
5
} ;
6
6
use serde:: { Deserialize , Serialize } ;
7
- use std:: path:: Path ;
7
+ use std:: path:: { Path , PathBuf } ;
8
8
9
9
/// The main configuration.
10
10
#[ derive( Debug , Deserialize , Serialize , PartialEq ) ]
11
11
pub struct Config {
12
+ allowed_signers : Option < PathBuf > ,
12
13
users : Option < Vec < User > > ,
13
14
organizations : Option < Vec < Organization > > ,
14
15
local : Option < Vec < String > > ,
@@ -19,6 +20,7 @@ impl Default for Config {
19
20
/// The default configuration containing common sources.
20
21
fn default ( ) -> Self {
21
22
Config {
23
+ allowed_signers : None ,
22
24
users : None ,
23
25
organizations : None ,
24
26
local : None ,
@@ -107,6 +109,7 @@ mod tests {
107
109
url = "https://git.acme.corp"
108
110
"# } ;
109
111
let expected = Config {
112
+ allowed_signers : None ,
110
113
users : Some ( vec ! [
111
114
User {
112
115
name: "torvalds" . to_string( ) ,
You can’t perform that action at this time.
0 commit comments