File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- use std:: { fs:: read_to_string, net:: IpAddr , path:: PathBuf } ;
1+ use std:: { fs:: read_to_string, net:: IpAddr , path:: PathBuf , time :: Duration } ;
22
33use clap:: Parser ;
44use log:: LevelFilter ;
@@ -9,6 +9,10 @@ fn default_url() -> Url {
99 Url :: parse ( "http://localhost:8080" ) . unwrap ( )
1010}
1111
12+ fn default_adoption_timeout ( ) -> u64 {
13+ 10
14+ }
15+
1216#[ derive( Parser , Debug , Deserialize , Clone ) ]
1317#[ command( version) ]
1418pub struct EnvConfig {
@@ -88,6 +92,24 @@ pub struct EnvConfig {
8892 /// Use Let's Encrypt staging environment for ACME issuance.
8993 #[ arg( long, env = "DEFGUARD_PROXY_ACME_STAGING" , default_value_t = false ) ]
9094 pub acme_staging : bool ,
95+
96+ /// Time limit in minutes for the auto-adoption process.
97+ /// After this time Edge will reject adoption attempts until restarted.
98+ #[ arg(
99+ long,
100+ short = 't' ,
101+ env = "DEFGUARD_ADOPTION_TIMEOUT" ,
102+ default_value = "10"
103+ ) ]
104+ #[ serde( default = "default_adoption_timeout" ) ]
105+ pub adoption_timeout : u64 ,
106+ }
107+
108+ impl EnvConfig {
109+ #[ must_use]
110+ pub fn adoption_timeout ( & self ) -> Duration {
111+ Duration :: from_secs ( self . adoption_timeout * 60 )
112+ }
91113}
92114
93115#[ derive( thiserror:: Error , Debug ) ]
You can’t perform that action at this time.
0 commit comments