diff --git a/checkrr.yaml.example b/checkrr.yaml.example index 574329b..f55cb61 100644 --- a/checkrr.yaml.example +++ b/checkrr.yaml.example @@ -33,6 +33,7 @@ arr: apikey: "" baseurl: / port: 7878 + ssl: false mappings: # maps directories between docker and arr services "/mnt/user/Movies/": "/Movies/" # what radarr sees: what checkrr sees radarr-4k: @@ -42,6 +43,7 @@ arr: apikey: "" baseurl: / port: 7979 + ssl: true mappings: "/mnt/user/Movies-4k/": "/Movies-4k/" sonarr: @@ -51,6 +53,7 @@ arr: apikey: "" baseurl: / port: 8989 + ssl: false mappings: "/mnt/user/tv/": "/tv/" anime: @@ -60,6 +63,7 @@ arr: apikey: "" baseurl: / port: 8888 + ssl: false mappings: "/mnt/user/anime/": "/anime/" lidarr: @@ -69,6 +73,7 @@ arr: apikey: "" baseurl: / port: 8686 + ssl: false mappings: "/mnt/user/Music/": "/Music" notifications: diff --git a/connections/lidarr.go b/connections/lidarr.go index 40238c0..f7a412a 100644 --- a/connections/lidarr.go +++ b/connections/lidarr.go @@ -18,6 +18,7 @@ type Lidarr struct { Address string Port int BaseURL string + SSL bool pathMaps map[string]string } @@ -29,6 +30,7 @@ func (l *Lidarr) FromConfig(conf *viper.Viper) { l.Port = conf.GetInt("port") l.BaseURL = conf.GetString("baseurl") l.pathMaps = conf.GetStringMapString("mappings") + l.SSL = conf.GetBool("ssl") log.Debugf("Lidarr Path Maps: %v", l.pathMaps) } else { l.Process = false @@ -87,7 +89,11 @@ func (l *Lidarr) RemoveFile(path string) bool { func (l *Lidarr) Connect() (bool, string) { if l.Process { if l.ApiKey != "" { - l.config = starr.New(l.ApiKey, fmt.Sprintf("http://%s:%v%v", l.Address, l.Port, l.BaseURL), 0) + protocol := "http" + if l.SSL { + protocol = "https" + } + l.config = starr.New(l.ApiKey, fmt.Sprintf("%s://%s:%v%v", protocol, l.Address, l.Port, l.BaseURL), 0) l.server = lidarr.New(l.config) status, err := l.server.GetSystemStatus() if err != nil { diff --git a/connections/radarr.go b/connections/radarr.go index 03d5d8e..c247c94 100644 --- a/connections/radarr.go +++ b/connections/radarr.go @@ -18,6 +18,7 @@ type Radarr struct { Address string Port int BaseURL string + SSL bool pathMaps map[string]string } @@ -29,6 +30,7 @@ func (r *Radarr) FromConfig(conf *viper.Viper) { r.Port = conf.GetInt("port") r.BaseURL = conf.GetString("baseurl") r.pathMaps = conf.GetStringMapString("mappings") + r.SSL = conf.GetBool("ssl") log.Debugf("Radarr Path Maps: %v", r.pathMaps) } else { r.Process = false @@ -66,7 +68,11 @@ func (r *Radarr) RemoveFile(path string) bool { func (r *Radarr) Connect() (bool, string) { if r.Process { if r.ApiKey != "" { - r.config = starr.New(r.ApiKey, fmt.Sprintf("http://%s:%v%v", r.Address, r.Port, r.BaseURL), 0) + protocol := "http" + if r.SSL { + protocol = "https" + } + r.config = starr.New(r.ApiKey, fmt.Sprintf("%s://%s:%v%v", protocol, r.Address, r.Port, r.BaseURL), 0) r.server = radarr.New(r.config) status, err := r.server.GetSystemStatus() if err != nil { diff --git a/connections/sonarr.go b/connections/sonarr.go index 3e29d04..7dd3e91 100644 --- a/connections/sonarr.go +++ b/connections/sonarr.go @@ -18,6 +18,7 @@ type Sonarr struct { Address string Port int BaseURL string + SSL bool pathMaps map[string]string } @@ -29,6 +30,7 @@ func (s *Sonarr) FromConfig(conf *viper.Viper) { s.Port = conf.GetInt("port") s.BaseURL = conf.GetString("baseurl") s.pathMaps = conf.GetStringMapString("mappings") + s.SSL = conf.GetBool("ssl") log.Debugf("Sonarr Path Maps: %v", s.pathMaps) } else { s.Process = false @@ -69,7 +71,11 @@ func (s *Sonarr) RemoveFile(path string) bool { func (s *Sonarr) Connect() (bool, string) { if s.Process { if s.ApiKey != "" { - s.config = starr.New(s.ApiKey, fmt.Sprintf("http://%s:%v%v", s.Address, s.Port, s.BaseURL), 0) + protocol := "http" + if s.SSL { + protocol = "https" + } + s.config = starr.New(s.ApiKey, fmt.Sprintf("%s://%s:%v%v", protocol, s.Address, s.Port, s.BaseURL), 0) s.server = sonarr.New(s.config) status, err := s.server.GetSystemStatus() if err != nil {