0
0
mirror of https://github.com/thegeeklab/wp-matrix.git synced 2024-11-29 05:10:35 +00:00
wp-matrix/cmd/drone-matrix/config.go

70 lines
2.3 KiB
Go
Raw Normal View History

2020-11-25 19:44:45 +00:00
// Copyright (c) 2020, the Drone Plugins project authors.
// Copyright (c) 2021, Robert Kaussow <mail@thegeeklab.de>
2020-11-25 19:44:45 +00:00
// Use of this source code is governed by an Apache 2.0 license that can be
// found in the LICENSE file.
package main
import (
"github.com/drone-plugins/drone-matrix/plugin"
"github.com/urfave/cli/v2"
)
// settingsFlags has the cli.Flags for the plugin.Settings.
func settingsFlags(settings *plugin.Settings, category string) []cli.Flag {
2020-11-25 19:44:45 +00:00
return []cli.Flag{
&cli.StringFlag{
Name: "username",
EnvVars: []string{"PLUGIN_USERNAME", "MATRIX_USERNAME"},
2022-05-29 20:22:48 +00:00
Usage: "authentication username",
2020-11-25 19:44:45 +00:00
Destination: &settings.Username,
Category: category,
2020-11-25 19:44:45 +00:00
},
&cli.StringFlag{
Name: "password",
EnvVars: []string{"PLUGIN_PASSWORD", "MATRIX_PASSWORD"},
2022-05-29 20:22:48 +00:00
Usage: "authentication password",
2020-11-25 19:44:45 +00:00
Destination: &settings.Password,
Category: category,
2020-11-25 19:44:45 +00:00
},
&cli.StringFlag{
Name: "userid",
EnvVars: []string{"PLUGIN_USERID,PLUGIN_USER_ID", "MATRIX_USERID", "MATRIX_USER_ID"},
2022-05-29 20:22:48 +00:00
Usage: "authentication user id",
2020-11-25 19:44:45 +00:00
Destination: &settings.UserID,
Category: category,
2020-11-25 19:44:45 +00:00
},
&cli.StringFlag{
Name: "accesstoken",
EnvVars: []string{"PLUGIN_ACCESSTOKEN,PLUGIN_ACCESS_TOKEN", "MATRIX_ACCESSTOKEN", "MATRIX_ACCESS_TOKEN"},
2022-05-29 20:22:48 +00:00
Usage: "authentication access token",
2020-11-25 19:44:45 +00:00
Destination: &settings.AccessToken,
Category: category,
2020-11-25 19:44:45 +00:00
},
&cli.StringFlag{
Name: "homeserver",
EnvVars: []string{"PLUGIN_HOMESERVER", "MATRIX_HOMESERVER"},
2022-05-29 20:22:48 +00:00
Usage: "matrix home server url",
2020-11-25 19:44:45 +00:00
Value: "https://matrix.org",
Destination: &settings.Homeserver,
Category: category,
2020-11-25 19:44:45 +00:00
},
&cli.StringFlag{
Name: "roomid",
EnvVars: []string{"PLUGIN_ROOMID", "MATRIX_ROOMID"},
2022-05-29 20:22:48 +00:00
Usage: "roomid to send messages to",
2020-11-25 19:44:45 +00:00
Destination: &settings.RoomID,
Category: category,
2020-11-25 19:44:45 +00:00
},
&cli.StringFlag{
Name: "template",
EnvVars: []string{"PLUGIN_TEMPLATE", "MATRIX_TEMPLATE"},
2022-05-29 20:22:48 +00:00
Usage: "message template",
Value: "Build {{ build.Status }} [{{ repo.Owner }}/{{ repo.Name }}#{{ truncate commit.SHA 8 }}]({{ build.Link }}) ({{ build.Branch }}) by {{ commit.Author }}",
2020-11-25 19:44:45 +00:00
Destination: &settings.Template,
Category: category,
2020-11-25 19:44:45 +00:00
},
}
}