Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

config: allow tls cert validity duration to be configured #185

Merged
merged 1 commit into from
Feb 21, 2024

Conversation

mrfelton
Copy link
Contributor

Fixes #184

This pull request includes changes to the config.go file that primarily focus on renaming and reusing the DefaultAutogenValidity constant as defaultTLSCertDuration and TLSCertDuration. The changes allow for the duration of the auto-generated TLS certificate to be customized.

Here are the key changes:

  • Renamed DefaultAutogenValidity to defaultTLSCertDuration and updated its comment to reflect the new name.
  • Added TLSCertDuration in the Config struct, which allows the user to set the duration for the auto-generated TLS certificate.
  • Set TLSCertDuration to defaultTLSCertDuration in the DefaultConfig function.
  • Replaced DefaultAutogenValidity with cfg.TLSCertDuration in the loadCertWithCreate function, which generates the TLS certificate. This allows the certificate's duration to be set based on the TLSCertDuration value in the Config struct.

Copy link
Member

@guggero guggero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, LGTM 🎉

config.go Outdated
TLSExtraDomains []string `long:"tlsextradomain" description:"Adds an extra domain to the generated certificate."`
TLSAutoRefresh bool `long:"tlsautorefresh" description:"Re-generate TLS certificate and key if the IPs or domains are changed."`
TLSDisableAutofill bool `long:"tlsdisableautofill" description:"Do not include the interface IPs or the system hostname in TLS certificate, use first --tlsextradomain as Common Name instead, if set."`
TLSCertDuration time.Duration `long:"tlscertduration" description:"The duration for which the auto-generated TLS certificate will be valid for"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

micro-nit: all the other descriptions end with a full stop.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, updated in new squashed commit. I actually pulled it over from lnd codebase, where none of the descriptions end in a full stop!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I know, this isn't very consistent across projects... But I guess it's nice to at least have consistency within the same block of config options.

@guggero guggero merged commit b56b878 into lightninglabs:master Feb 21, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TLS certificate validity period should be configurable
2 participants