Skip to content

Commit

Permalink
Don't set the application URL by default.
Browse files Browse the repository at this point in the history
...because that tells veil to set up its reverse proxy, which
subsequently sends requests to a web server that doesn't exist.
Instead, only try to parse the given web server if it's set.
  • Loading branch information
NullHypothesis committed Dec 12, 2024
1 parent ac2e2c9 commit 9f0901c
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions cmd/veil/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import (
"github.com/Amnesic-Systems/veil/internal/httpx"
"github.com/Amnesic-Systems/veil/internal/service"
"github.com/Amnesic-Systems/veil/internal/tunnel"
"github.com/Amnesic-Systems/veil/internal/util"
)

const (
Expand All @@ -42,8 +41,8 @@ func parseFlags(out io.Writer, args []string) (*config.Config, error) {
)
appWebSrv := fs.String(
"app-web-srv",
"localhost:8081",
"application web server",
"",
"application web server, e.g. http://localhost:8081",
)
debug := fs.Bool(
"debug",
Expand Down Expand Up @@ -91,15 +90,24 @@ func parseFlags(out io.Writer, args []string) (*config.Config, error) {
"wait for the application to signal readiness",
)

if err := fs.Parse(args); err != nil {
var err error
if err = fs.Parse(args); err != nil {
fs.PrintDefaults()
return nil, fmt.Errorf("failed to parse flags: %w", err)
}

var u *url.URL
if *appWebSrv != "" {
u, err = url.Parse(*appWebSrv)
if err != nil {
return nil, fmt.Errorf("failed to parse -app-web-srv: %w", err)
}
}

// Build and validate the config.
return &config.Config{
AppCmd: *appCmd,
AppWebSrv: util.Must(url.Parse(*appWebSrv)),
AppWebSrv: u,
Debug: *debug,
EnclaveCodeURI: *enclaveCodeURI,
ExtPort: *extPort,
Expand Down

0 comments on commit 9f0901c

Please sign in to comment.