Skip to content

Commit

Permalink
Add back host/port flags
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Moore <mattmoor@chainguard.dev>
  • Loading branch information
mattmoor committed Dec 6, 2021
1 parent 5b36f68 commit aa723db
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
12 changes: 5 additions & 7 deletions cmd/app/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import (
"flag"
"fmt"
"net/http"
"os"

"github.com/prometheus/client_golang/prometheus/promhttp"
"github.com/sigstore/fulcio/pkg/api"
Expand Down Expand Up @@ -124,13 +123,9 @@ var serveCmd = &cobra.Command{
_ = prom.ListenAndServe()
}()

port := os.Getenv("PORT")
if port == "" {
port = "8080"
}

host, port := viper.GetString("host"), viper.GetString("port")
api := http.Server{
Addr: ":" + port,
Addr: host + ":" + port,
Handler: decorateHandler(api.NewHandler()),
}

Expand All @@ -141,5 +136,8 @@ var serveCmd = &cobra.Command{
}

func init() {
serveCmd.PersistentFlags().String("host", "0.0.0.0", "The host on which to serve requests")
serveCmd.PersistentFlags().String("port", "8080", "The port on which to serve requests")

rootCmd.AddCommand(serveCmd)
}
3 changes: 1 addition & 2 deletions config/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,11 @@ spec:
- containerPort: 2112 # metrics
args: [
"serve",
"--host=0.0.0.0", "--port=5555",
"--ca=googleca", "--gcp_private_ca_parent=$(CA_PARENT)", "--gcp_private_ca_version=v1",
"--ct-log-url=http://ct-log/test", "--log_type=prod",
]
env:
- name: PORT
value: "5555"
- name: CA_PARENT
valueFrom:
configMapKeyRef:
Expand Down

0 comments on commit aa723db

Please sign in to comment.