Added url_base parameter to customize the root url and allow hosting with another application. (#41)

* Added `url_base` parameter and code to rewrite URL

* Manage redirect on stats login

Co-authored-by: Nicolas Ledez <github.public@ledez.net>
This commit is contained in:
Nicolas Ledez
2022-07-08 18:44:49 +02:00
committed by GitHub
parent f09f2df2e3
commit a5d18ef24c
4 changed files with 39 additions and 28 deletions

View File

@ -8,6 +8,7 @@ import (
type Config struct {
BindAddress string `mapstructure:"bind_address"`
Port string `mapstructure:"listen_port"`
BaseURL string `mapstructure:"url_base"`
ProxyProtocolPort string `mapstructure:"proxyprotocol_port"`
ServerLat float64 `mapstructure:"server_lat"`
ServerLng float64 `mapstructure:"server_lng"`
@ -39,6 +40,7 @@ var (
func init() {
viper.SetDefault("listen_port", "8989")
viper.SetDefault("url_base", "")
viper.SetDefault("proxyprotocol_port", "0")
viper.SetDefault("download_chunks", 4)
viper.SetDefault("distance_unit", "K")