added check at startup for proxy_url
This commit is contained in:
parent
a4cebb28b0
commit
b954091a8f
1 changed files with 12 additions and 1 deletions
13
main.go
13
main.go
|
@ -10,6 +10,7 @@ import (
|
|||
"io/ioutil"
|
||||
"log"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
@ -52,13 +53,23 @@ func newWeb() *Web {
|
|||
|
||||
func (web *Web) init() {
|
||||
web.urlCache = make(map[string]string, 5)
|
||||
web.validateProxyURL()
|
||||
web.initDB()
|
||||
|
||||
web.initRouter()
|
||||
web.initCronJobs()
|
||||
web.initNotifiers()
|
||||
}
|
||||
|
||||
func (web *Web) validateProxyURL() {
|
||||
if viper.IsSet("proxy.proxy_url") {
|
||||
_, err := url.Parse(viper.GetString("proxy.proxy_url"))
|
||||
if err != nil {
|
||||
log.Println("Could not parse proxy url, check config")
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (web *Web) initDB() {
|
||||
dsn := "./watch.db"
|
||||
if viper.IsSet("database.dsn") {
|
||||
|
|
Loading…
Add table
Reference in a new issue