gotty icon indicating copy to clipboard operation
gotty copied to clipboard

Custom path

Open jayeye opened this issue 5 years ago • 2 comments

This is too short to submit as a PR, so here it goes: Add a custom path option; useful when sitting behind a reverse proxy.

diff --git a/server/options.go b/server/options.go
index 3d7f69c..7a444da 100644
--- a/server/options.go
+++ b/server/options.go
@@ -14,2 +14,3 @@ type Options struct {
        RandomUrlLength     int              `hcl:"random_url_length" flagName:"random-url-length" flagDescribe:"Random URL length" default:"8"`
+       Path                string           `hcl:"path" flagName:"path" flagSName:"P" flagDescribe:"Add this string to the URL" default: ""`
        EnableTLS           bool             `hcl:"enable_tls" flagName:"tls" flagSName:"t" flagDescribe:"Enable TLS/SSL" default:"false"`
diff --git a/server/server.go b/server/server.go
index 6411e71..f28a303 100644
--- a/server/server.go
+++ b/server/server.go
@@ -97,3 +97,3 @@ func (server *Server) Run(ctx context.Context, options ...RunOption) error {

-       path := "/"
+       path := "/" + server.options.Path + "/"
        if server.options.EnableRandomUrl {

jayeye avatar Aug 17 '19 21:08 jayeye

Does this also cover config files? If it does, it fixes my issue and ill merge it into my own local source and recompile.

EclectickMedia avatar Aug 28 '19 02:08 EclectickMedia

@yudai doesn't it make sense to have this too in gotty?

Sup3rGeo avatar Apr 21 '21 06:04 Sup3rGeo