Skip to content

Commit

Permalink
Introduce flags for preview command
Browse files Browse the repository at this point in the history
  • Loading branch information
mraerino committed Feb 4, 2024
1 parent 1addbd2 commit f112c8f
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions cmd/tf-preview-gh/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package main
import (
"bufio"
"context"
"flag"
"fmt"
"io"
"net/http"
Expand Down Expand Up @@ -148,16 +149,25 @@ func streamLogs(logsURL *url.URL, skip int64) (int64, error) {
return int64(r.readBytes), err
}

const (
owner = "ffddorf"
repo = "terraform-playground"
workflowFilename = "preview.yaml"
var (
owner string
repo string
workflowFilename string
)

func main() {
ctx, cancel := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM)
defer cancel()

flag.StringVar(&owner, "github-owner", "ffddorf", "Repository owner")
flag.StringVar(&repo, "github-repo", "", "Repository name")
flag.StringVar(&workflowFilename, "workflow-file", "preview.yaml", "Name of the workflow file to run for previews")
flag.Parse()

if repo == "" {
panic("Missing flag: -github-repo")
}

serverURL, err := startServer(ctx)
if err != nil {
panic(err)
Expand Down

0 comments on commit f112c8f

Please sign in to comment.