mirror of
https://github.com/lldap/lldap.git
synced 2024-11-25 09:06:03 +00:00
server: Add http_url to the configuration
This commit is contained in:
parent
a13bfc3575
commit
db2b5cbae0
3 changed files with 14 additions and 0 deletions
|
@ -10,6 +10,9 @@
|
|||
## administration.
|
||||
#http_port = 17170
|
||||
|
||||
## The public URL of the server, for password reset links.
|
||||
#http_url = "http://localhost"
|
||||
|
||||
## Random secret for JWT signature.
|
||||
## This secret should be random, and should be shared with application
|
||||
## servers that need to consume the JWTs.
|
||||
|
|
|
@ -10,6 +10,7 @@ pub struct CLIOpts {
|
|||
pub command: Command,
|
||||
}
|
||||
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
#[derive(Debug, Clap, Clone)]
|
||||
pub enum Command {
|
||||
/// Export the GraphQL schema to *.graphql.
|
||||
|
@ -56,6 +57,10 @@ pub struct RunOpts {
|
|||
#[clap(long, env = "LLDAP_HTTP_PORT")]
|
||||
pub http_port: Option<u16>,
|
||||
|
||||
/// URL of the server, for password reset links.
|
||||
#[clap(long, env = "LLDAP_HTTP_URL")]
|
||||
pub http_url: Option<String>,
|
||||
|
||||
#[clap(flatten)]
|
||||
pub smtp_opts: SmtpOpts,
|
||||
}
|
||||
|
|
|
@ -64,6 +64,8 @@ pub struct Configuration {
|
|||
pub key_file: String,
|
||||
#[builder(default)]
|
||||
pub smtp_options: MailOptions,
|
||||
#[builder(default = r#"String::from("http://localhost")"#)]
|
||||
pub http_url: String,
|
||||
#[serde(skip)]
|
||||
#[builder(field(private), setter(strip_option))]
|
||||
server_setup: Option<ServerSetup>,
|
||||
|
@ -152,6 +154,10 @@ impl ConfigOverrider for RunOpts {
|
|||
if let Some(port) = self.http_port {
|
||||
config.http_port = port;
|
||||
}
|
||||
|
||||
if let Some(url) = self.http_url.as_ref() {
|
||||
config.http_url = url.to_string();
|
||||
}
|
||||
self.smtp_opts.override_config(config);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue