gotty
gotty copied to clipboard
Custom path
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 {
Does this also cover config files? If it does, it fixes my issue and ill merge it into my own local source and recompile.
@yudai doesn't it make sense to have this too in gotty?