diff options
Diffstat (limited to 'internal/config')
| -rw-r--r-- | internal/config/config.go | 11 | ||||
| -rw-r--r-- | internal/config/defaults.go | 11 | ||||
| -rw-r--r-- | internal/config/flags.go | 1 | ||||
| -rw-r--r-- | internal/config/helpers.gen.go | 25 | 
4 files changed, 38 insertions, 10 deletions
| diff --git a/internal/config/config.go b/internal/config/config.go index 21c1ca470..a1e00ea8d 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -126,11 +126,12 @@ type Configuration struct {  	OIDCLinkExisting     bool     `name:"oidc-link-existing" usage:"link existing user accounts to OIDC logins based on the stored email value"`  	OIDCAdminGroups      []string `name:"oidc-admin-groups" usage:"Membership of one of the listed groups makes someone a GtS admin"` -	SMTPHost     string `name:"smtp-host" usage:"Host of the smtp server. Eg., 'smtp.eu.mailgun.org'"` -	SMTPPort     int    `name:"smtp-port" usage:"Port of the smtp server. Eg., 587"` -	SMTPUsername string `name:"smtp-username" usage:"Username to authenticate with the smtp server as. Eg., 'postmaster@mail.example.org'"` -	SMTPPassword string `name:"smtp-password" usage:"Password to pass to the smtp server."` -	SMTPFrom     string `name:"smtp-from" usage:"Address to use as the 'from' field of the email. Eg., 'gotosocial@example.org'"` +	SMTPHost               string `name:"smtp-host" usage:"Host of the smtp server. Eg., 'smtp.eu.mailgun.org'"` +	SMTPPort               int    `name:"smtp-port" usage:"Port of the smtp server. Eg., 587"` +	SMTPUsername           string `name:"smtp-username" usage:"Username to authenticate with the smtp server as. Eg., 'postmaster@mail.example.org'"` +	SMTPPassword           string `name:"smtp-password" usage:"Password to pass to the smtp server."` +	SMTPFrom               string `name:"smtp-from" usage:"Address to use as the 'from' field of the email. Eg., 'gotosocial@example.org'"` +	SMTPDiscloseRecipients bool   `name:"smtp-disclose-recipients" usage:"If true, email notifications sent to multiple recipients will be To'd to every recipient at once. If false, recipients will not be disclosed"`  	SyslogEnabled  bool   `name:"syslog-enabled" usage:"Enable the syslog logging hook. Logs will be mirrored to the configured destination."`  	SyslogProtocol string `name:"syslog-protocol" usage:"Protocol to use when directing logs to syslog. Leave empty to connect to local syslog."` diff --git a/internal/config/defaults.go b/internal/config/defaults.go index b687b43f1..17cc71086 100644 --- a/internal/config/defaults.go +++ b/internal/config/defaults.go @@ -102,11 +102,12 @@ var Defaults = Configuration{  	OIDCScopes:           []string{oidc.ScopeOpenID, "profile", "email", "groups"},  	OIDCLinkExisting:     false, -	SMTPHost:     "", -	SMTPPort:     0, -	SMTPUsername: "", -	SMTPPassword: "", -	SMTPFrom:     "GoToSocial", +	SMTPHost:               "", +	SMTPPort:               0, +	SMTPUsername:           "", +	SMTPPassword:           "", +	SMTPFrom:               "GoToSocial", +	SMTPDiscloseRecipients: false,  	SyslogEnabled:  false,  	SyslogProtocol: "udp", diff --git a/internal/config/flags.go b/internal/config/flags.go index 09e927785..e9925ded0 100644 --- a/internal/config/flags.go +++ b/internal/config/flags.go @@ -132,6 +132,7 @@ func (s *ConfigState) AddServerFlags(cmd *cobra.Command) {  		cmd.Flags().String(SMTPUsernameFlag(), cfg.SMTPUsername, fieldtag("SMTPUsername", "usage"))  		cmd.Flags().String(SMTPPasswordFlag(), cfg.SMTPPassword, fieldtag("SMTPPassword", "usage"))  		cmd.Flags().String(SMTPFromFlag(), cfg.SMTPFrom, fieldtag("SMTPFrom", "usage")) +		cmd.Flags().Bool(SMTPDiscloseRecipientsFlag(), cfg.SMTPDiscloseRecipients, fieldtag("SMTPDiscloseRecipients", "usage"))  		// Syslog  		cmd.Flags().Bool(SyslogEnabledFlag(), cfg.SyslogEnabled, fieldtag("SyslogEnabled", "usage")) diff --git a/internal/config/helpers.gen.go b/internal/config/helpers.gen.go index 53553d851..6fc195ad0 100644 --- a/internal/config/helpers.gen.go +++ b/internal/config/helpers.gen.go @@ -1924,6 +1924,31 @@ func GetSMTPFrom() string { return global.GetSMTPFrom() }  // SetSMTPFrom safely sets the value for global configuration 'SMTPFrom' field  func SetSMTPFrom(v string) { global.SetSMTPFrom(v) } +// GetSMTPDiscloseRecipients safely fetches the Configuration value for state's 'SMTPDiscloseRecipients' field +func (st *ConfigState) GetSMTPDiscloseRecipients() (v bool) { +	st.mutex.Lock() +	v = st.config.SMTPDiscloseRecipients +	st.mutex.Unlock() +	return +} + +// SetSMTPDiscloseRecipients safely sets the Configuration value for state's 'SMTPDiscloseRecipients' field +func (st *ConfigState) SetSMTPDiscloseRecipients(v bool) { +	st.mutex.Lock() +	defer st.mutex.Unlock() +	st.config.SMTPDiscloseRecipients = v +	st.reloadToViper() +} + +// SMTPDiscloseRecipientsFlag returns the flag name for the 'SMTPDiscloseRecipients' field +func SMTPDiscloseRecipientsFlag() string { return "smtp-disclose-recipients" } + +// GetSMTPDiscloseRecipients safely fetches the value for global configuration 'SMTPDiscloseRecipients' field +func GetSMTPDiscloseRecipients() bool { return global.GetSMTPDiscloseRecipients() } + +// SetSMTPDiscloseRecipients safely sets the value for global configuration 'SMTPDiscloseRecipients' field +func SetSMTPDiscloseRecipients(v bool) { global.SetSMTPDiscloseRecipients(v) } +  // GetSyslogEnabled safely fetches the Configuration value for state's 'SyslogEnabled' field  func (st *ConfigState) GetSyslogEnabled() (v bool) {  	st.mutex.Lock() | 
