|
|
@ -56,12 +56,17 @@ type Params struct { |
|
|
|
// AuthRatelimit indicates how much time must pass between subsequent auth
|
|
|
|
// AuthRatelimit indicates how much time must pass between subsequent auth
|
|
|
|
// attempts.
|
|
|
|
// attempts.
|
|
|
|
AuthRatelimit time.Duration |
|
|
|
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.
|
|
|
|
// SetupCfg implement the cfg.Cfger interface.
|
|
|
|
func (p *Params) SetupCfg(cfg *cfg.Cfg) { |
|
|
|
func (p *Params) SetupCfg(cfg *cfg.Cfg) { |
|
|
|
|
|
|
|
|
|
|
|
publicURLStr := cfg.String("http-public-url", "http://localhost:4000", "URL this service is accessible at") |
|
|
|
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.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") |
|
|
|
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) |
|
|
|
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 |
|
|
|
return nil |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|