···5050 /// the address of this server
5151 ///
5252 /// used if --acme-domain is not set, defaulting to `--bind`
5353- #[arg(long, conflicts_with("acme_domain"), env = "SLINGSHOT_PUBLIC_HOST")]
5353+ #[arg(long, conflicts_with("tls_domain"), env = "SLINGSHOT_PUBLIC_HOST")]
5454 base_url: Option<Url>,
5555 /// the domain pointing to this server
5656 ///
5757 /// if present:
5858 /// - a did:web document will be served at /.well-known/did.json
5959- /// - an HTTPS certs will be automatically configured with Acme/letsencrypt
5959+ /// - the server will bind on port 443
6060+ /// - if `--acme-contact` is present, the server will bind port 80 for http
6161+ /// challenges and attempt to auto-provision certs for `--tls-domain`
6262+ /// - if `--acme-contact is absent, the server will load certs from the
6363+ /// `--tls-certs` folder, and try to reload them twice daily, guarded by
6464+ /// a lock file called `.cert-lock` in the `--tls-certs` folder.
6065 /// - TODO: a rate-limiter will be installed
6166 #[arg(
6267 long,
6368 conflicts_with("bind"),
6464- requires("acme_cache_path"),
6565- env = "SLINGSHOT_ACME_DOMAIN"
6969+ requires("tls_certs"),
7070+ env = "SLINGSHOT_TLS_DOMAIN"
6671 )]
6767- acme_domain: Option<String>,
7272+ tls_domain: Option<String>,
7373+ /// a location to find/cache acme or other tls certs
7474+ ///
7575+ /// recommended in production, mind the file permissions.
7676+ #[arg(long, env = "SLINGSHOT_TLS_CERTS_PATH")]
7777+ tls_certs: Option<PathBuf>,
7878+ /// listen for ipv6 when using acme or other tls
7979+ ///
8080+ /// you must also configure the relevant DNS records for this to work
8181+ #[arg(long, action, requires("tls_domain"), env = "SLINGSHOT_TLS_IPV6")]
8282+ tls_ipv6: bool,
8383+ /// redirect acme http-01 challenges to this url
8484+ ///
8585+ /// useful if you're setting up a second instance that synchronizes its
8686+ /// certs from a main instance doing acme.
8787+ #[arg(
8888+ long,
8989+ conflicts_with("acme_contact"),
9090+ requires("tls_domain"),
9191+ env = "SLINGSHOT_ACME_CHALLENGE_REDIRECT"
9292+ )]
9393+ acme_challenge_redirect: Option<String>,
6894 /// email address for letsencrypt contact
6995 ///
7096 /// recommended in production, i guess?
7171- #[arg(long, requires("acme_domain"), env = "SLINGSHOT_ACME_CONTACT")]
9797+ #[arg(long, requires("tls_domain"), env = "SLINGSHOT_ACME_CONTACT")]
7298 acme_contact: Option<String>,
7373- /// a location to cache acme https certs
7474- ///
7575- /// required when (and only used when) --acme-domain is specified.
7676- ///
7777- /// recommended in production, but mind the file permissions.
7878- #[arg(long, requires("acme_domain"), env = "SLINGSHOT_ACME_CACHE_PATH")]
7979- acme_cache_path: Option<PathBuf>,
8080- /// listen for ipv6 when using acme
9999+ /// use the staging environment for letsencrypt
81100 ///
8282- /// you must also configure the relevant DNS records for this to work
8383- #[arg(long, action, requires("acme_domain"), env = "SLINGSHOT_ACME_IPV6")]
8484- acme_ipv6: bool,
101101+ /// recommended to initially test out new deployments with this to avoid
102102+ /// letsencrypt rate limit problems.
103103+ #[arg(long, action, requires("acme_contact"), env = "SLINGSHOT_ACME_STAGING")]
104104+ acme_staging: bool,
85105 /// an web address to send healtcheck pings to every ~51s or so
86106 #[arg(long, env = "SLINGSHOT_HEALTHCHECK")]
87107 healthcheck: Option<String>,
···108128 let base_url: Url = args
109129 .base_url
110130 .or_else(|| {
111111- args.acme_domain
131131+ args.tls_domain
112132 .as_ref()
113133 .map(|d| Url::parse(&format!("https://{d}")).unwrap())
114134 })
···178198 repo,
179199 proxy,
180200 base_url,
181181- args.acme_domain,
201201+ args.tls_domain,
202202+ args.tls_certs,
203203+ args.tls_ipv6,
204204+ args.acme_challenge_redirect,
182205 args.acme_contact,
183183- args.acme_cache_path,
184184- args.acme_ipv6,
206206+ args.acme_staging,
185207 server_shutdown,
186208 bind,
187209 )