summaryrefslogtreecommitdiff
path: root/src/http/http.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/http/http.go')
-rw-r--r--src/http/http.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/http/http.go b/src/http/http.go
index da39374..98cdde3 100644
--- a/src/http/http.go
+++ b/src/http/http.go
@@ -56,12 +56,17 @@ type Params struct {
// AuthRatelimit indicates how much time must pass between subsequent auth
// attempts.
AuthRatelimit time.Duration
+
+ // GeminiGatewayURL will be used to translate links for `gemini://` into
+ // `http(s)://`. See gmi.GemtextToMarkdown.
+ GeminiGatewayURL *url.URL
}
// SetupCfg implement the cfg.Cfger interface.
func (p *Params) SetupCfg(cfg *cfg.Cfg) {
publicURLStr := cfg.String("http-public-url", "http://localhost:4000", "URL this service is accessible at")
+ geminiGatewayURLStr := cfg.String("http-gemini-gateway-url", "", "Optional URL to prefix to all gemini:// links, to make them accessible over https")
cfg.StringVar(&p.ListenProto, "http-listen-proto", "tcp", "Protocol to listen for HTTP requests with")
cfg.StringVar(&p.ListenAddr, "http-listen-addr", ":4000", "Address/unix socket path to listen for HTTP requests on")
@@ -87,6 +92,12 @@ func (p *Params) SetupCfg(cfg *cfg.Cfg) {
return fmt.Errorf("parsing -http-public-url: %w", err)
}
+ if *geminiGatewayURLStr != "" {
+ if p.GeminiGatewayURL, err = url.Parse(*geminiGatewayURLStr); err != nil {
+ return fmt.Errorf("parsing -http-gemini-gateway-url: %w", err)
+ }
+ }
+
return nil
})
}