diff options
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/gotosocial/common.go | 9 | ||||
-rw-r--r-- | cmd/gotosocial/flag/server.go | 8 | ||||
-rw-r--r-- | cmd/gotosocial/flag/usage.go | 3 |
3 files changed, 13 insertions, 7 deletions
diff --git a/cmd/gotosocial/common.go b/cmd/gotosocial/common.go index 7b5a42652..3f4b12613 100644 --- a/cmd/gotosocial/common.go +++ b/cmd/gotosocial/common.go @@ -23,7 +23,6 @@ import ( "fmt" "github.com/spf13/cobra" - "github.com/spf13/viper" "github.com/superseriousbusiness/gotosocial/cmd/gotosocial/action" "github.com/superseriousbusiness/gotosocial/internal/config" "github.com/superseriousbusiness/gotosocial/internal/log" @@ -52,12 +51,8 @@ func preRun(cmd *cobra.Command) error { // The idea here is to take a GTSAction and run it with the given // context, after initializing any last-minute things like loggers etc. func run(ctx context.Context, action action.GTSAction) error { - // if log level has been set... - if logLevel := viper.GetString(config.Keys.LogLevel); logLevel != "" { - // then try to initialize the logger to that level - if err := log.Initialize(logLevel); err != nil { - return fmt.Errorf("error initializing log: %s", err) - } + if err := log.Initialize(); err != nil { + return fmt.Errorf("error initializing log: %s", err) } return action(ctx) diff --git a/cmd/gotosocial/flag/server.go b/cmd/gotosocial/flag/server.go index 3d3e946f3..aa68573a4 100644 --- a/cmd/gotosocial/flag/server.go +++ b/cmd/gotosocial/flag/server.go @@ -34,6 +34,7 @@ func Server(cmd *cobra.Command, values config.Values) { OIDC(cmd, values) SMTP(cmd, values) Router(cmd, values) + Syslog(cmd, values) } // Router attaches flags pertaining to the gin router. @@ -109,3 +110,10 @@ func SMTP(cmd *cobra.Command, values config.Values) { cmd.Flags().String(config.Keys.SMTPPassword, values.SMTPPassword, usage.SMTPPassword) cmd.Flags().String(config.Keys.SMTPFrom, values.SMTPFrom, usage.SMTPFrom) } + +// Syslog attaches flags pertaining to syslog config. +func Syslog(cmd *cobra.Command, values config.Values) { + cmd.Flags().Bool(config.Keys.SyslogEnabled, values.SyslogEnabled, usage.SyslogEnabled) + cmd.Flags().String(config.Keys.SyslogProtocol, values.SyslogProtocol, usage.SyslogProtocol) + cmd.Flags().String(config.Keys.SyslogAddress, values.SyslogAddress, usage.SyslogAddress) +} diff --git a/cmd/gotosocial/flag/usage.go b/cmd/gotosocial/flag/usage.go index aa57048c1..ada5ab271 100644 --- a/cmd/gotosocial/flag/usage.go +++ b/cmd/gotosocial/flag/usage.go @@ -73,6 +73,9 @@ var usage = config.KeyNames{ SMTPUsername: "Username to authenticate with the smtp server as. Eg., 'postmaster@mail.example.org'", SMTPPassword: "Password to pass to the smtp server.", SMTPFrom: "Address to use as the 'from' field of the email. Eg., 'gotosocial@example.org'", + SyslogEnabled: "Enable the syslog logging hook. Logs will be mirrored to the configured destination.", + SyslogProtocol: "Protocol to use when directing logs to syslog. Leave empty to connect to local syslog.", + SyslogAddress: "Address:port to send syslog logs to. Leave empty to connect to local syslog.", AdminAccountUsername: "the username to create/delete/etc", AdminAccountEmail: "the email address of this account", AdminAccountPassword: "the password to set for this account", |