Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: support wildcard apps over tunnel#4602

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
deansheather merged 1 commit intomainfromdean/tunnel-apps
Oct 20, 2022
Merged
Changes fromall 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
20 changes: 16 additions & 4 deletionscli/server.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -207,15 +207,25 @@ func Server(dflags *codersdk.DeploymentFlags, newAPI func(context.Context, *code
)
defer closeTunnel()

// If the access URL is empty, we attempt to run a reverse-proxy tunnel
// to make the initial setup really simple.
// If the access URL is empty, we attempt to run a reverse-proxy
//tunnelto make the initial setup really simple.
if dflags.AccessURL.Value == "" {
cmd.Printf("Opening tunnel so workspaces can connect to your deployment. For production scenarios, specify an external access URL\n")
tunnel, tunnelErr, err = devtunnel.New(ctxTunnel, logger.Named("devtunnel"))
if err != nil {
return xerrors.Errorf("create tunnel: %w", err)
}
dflags.AccessURL.Value = tunnel.URL

if dflags.WildcardAccessURL.Value == "" {
u, err := parseURL(ctx, tunnel.URL)
if err != nil {
return xerrors.Errorf("parse tunnel url: %w", err)
}

// Suffixed wildcard access URL.
dflags.WildcardAccessURL.Value = fmt.Sprintf("*--%s", u.Hostname())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Shouldn't this just be one hypen?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

acutaly looks like ti deosnt matter

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

yeah it doesn't matter on the server side how many hyphens you use, but I used two here so it matches the two hyphens between each app component

}
}

accessURLParsed, err := parseURL(ctx, dflags.AccessURL.Value)
Expand DownExpand Up@@ -735,7 +745,7 @@ func Server(dflags *codersdk.DeploymentFlags, newAPI func(context.Context, *code

// parseURL parses a string into a URL. It works around some technically correct
// but undesired behavior of url.Parse by prepending a scheme if one does not
// exist so that the URL does not get parsedimproprely.
// exist so that the URL does not get parsedimproperly.
func parseURL(ctx context.Context, u string) (*url.URL, error) {
var (
hasScheme = strings.HasPrefix(u, "http:") || strings.HasPrefix(u, "https:")
Expand DownExpand Up@@ -1091,7 +1101,9 @@ func serveHandler(ctx context.Context, logger slog.Logger, handler http.Handler,
}
}()

return func() { _ = srv.Close() }
return func() {
_ = srv.Close()
}
}

// embeddedPostgresURL returns the URL for the embedded PostgreSQL deployment.
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp