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

remove sensitive cli flag #6

Merged
merged 1 commit into from
Jun 23, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions internal/cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ func NewRootCommand() *cobra.Command {

cmd.PersistentFlags().String("log-level", "info", "Configure log level")
cmd.PersistentFlags().String("listen-address", ":8080", "Server listen address")
cmd.PersistentFlags().String("secret", "", "Token used to authenticate http requests to the extension")

cmd.AddCommand(newVersionCommand())
return cmd
Expand Down Expand Up @@ -53,10 +52,10 @@ func (c *RootCommand) persistentPreRunE(cmd *cobra.Command, args []string) error

func (c *RootCommand) runE(cmd *cobra.Command, args []string) error {
addr := viper.GetString("listen-address")
secret := viper.GetString("secret")

secret := viper.GetString("secret")
if secret == "" {
return fmt.Errorf("--secret flag is required")
return fmt.Errorf("DRONE_SECRET environment variable is required")
}

log.Printf("Starting server on %s\n", addr)
Expand Down