Fallback pour localStorage et config simplifiée de l'adresse publique de l'app client
This commit is contained in:
@ -19,15 +19,13 @@ type Config struct {
|
||||
|
||||
// HTTPConfig is the configuration part which defines HTTP related params
|
||||
type HTTPConfig struct {
|
||||
BaseURL string `yaml:"baseurl" env:"GUESSTIMATE_BASE_URL"`
|
||||
Address string `yaml:"address" env:"GUESSTIMATE_HTTP_ADDRESS"`
|
||||
PublicDir string `yaml:"publicDir" env:"GUESSTIMATE_PUBLIC_DIR"`
|
||||
}
|
||||
|
||||
// ClientConfig is the configuration part which defines the client app related params
|
||||
type ClientConfig struct {
|
||||
BaseURL string `yaml:"baseurl" env:"GUESSTIMATE_CLIENT_BASE_URL"`
|
||||
Address string `yaml:"address" env:"GUESSTIMATE_CLIENT_HTTP_ADDRESS"`
|
||||
PublicBaseURL string `yaml:"publicbaseurl" env:"GUESSTIMATE_CLIENT_PUBLIC_BASE_URL"`
|
||||
}
|
||||
|
||||
// DataConfig is the configuration part which defines data related params
|
||||
@ -70,13 +68,11 @@ func NewDumpDefault() *Config {
|
||||
func NewDefault() *Config {
|
||||
return &Config{
|
||||
HTTP: HTTPConfig{
|
||||
BaseURL: "localhost",
|
||||
Address: ":8081",
|
||||
PublicDir: "public",
|
||||
},
|
||||
Client: ClientConfig{
|
||||
BaseURL: "localhost",
|
||||
Address: ":8080",
|
||||
PublicBaseURL: "http://localhost:8080",
|
||||
},
|
||||
Data: DataConfig{
|
||||
Path: "guesstimate.db",
|
||||
|
@ -88,8 +88,7 @@ func handleExportProject(w http.ResponseWriter, r *http.Request) {
|
||||
url string
|
||||
)
|
||||
|
||||
url = "http://" + string(cfg.Client.BaseURL) + string(cfg.Client.Address) + "/pdf/" + string(projectID)
|
||||
fmt.Println(url)
|
||||
url = string(cfg.Client.PublicBaseURL) + "/pdf/" + string(projectID)
|
||||
|
||||
// Create new PDF generator
|
||||
pdfg, err := wkhtmltopdf.NewPDFGenerator()
|
||||
|
Reference in New Issue
Block a user