2022-03-21 22:27:35 +00:00
|
|
|
package internal
|
|
|
|
|
2022-03-22 22:59:09 +00:00
|
|
|
import (
|
|
|
|
"net/url"
|
|
|
|
|
|
|
|
log "github.com/sirupsen/logrus"
|
|
|
|
)
|
|
|
|
|
2022-03-21 22:27:35 +00:00
|
|
|
// Config contains the server configuration parameters
|
|
|
|
type Config struct {
|
2022-03-26 01:42:40 +00:00
|
|
|
Debug bool
|
|
|
|
|
|
|
|
TLS bool `json:"-"`
|
|
|
|
TLSKey string `json:"-"`
|
|
|
|
TLSCert string `json:"-"`
|
|
|
|
|
2022-04-02 02:59:39 +00:00
|
|
|
Data string `json:"-"`
|
|
|
|
Store string `json:"-"`
|
2022-03-22 22:59:09 +00:00
|
|
|
|
2022-10-15 21:45:13 +00:00
|
|
|
|
2022-04-02 02:59:39 +00:00
|
|
|
BaseURL string
|
2022-10-15 21:45:13 +00:00
|
|
|
BrokerURI string
|
2022-04-02 02:59:39 +00:00
|
|
|
PrimaryDomain string
|
|
|
|
|
|
|
|
AdminUser string `json:"-"`
|
|
|
|
SupportEmail string `json:"-"`
|
2022-03-26 01:42:40 +00:00
|
|
|
|
2022-03-22 22:59:09 +00:00
|
|
|
baseURL *url.URL
|
2022-03-21 22:27:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Validate validates the configuration is valid which for the most part
|
|
|
|
// just ensures that default secrets are actually configured correctly
|
|
|
|
func (c *Config) Validate() error {
|
2022-03-22 22:59:09 +00:00
|
|
|
// Automatically correct missing Scheme in Pod Base URL
|
|
|
|
if c.baseURL.Scheme == "" {
|
|
|
|
log.Warnf("base url (-u/--base-url) %s is missing the scheme", c.BaseURL)
|
|
|
|
c.baseURL.Scheme = "http"
|
|
|
|
c.BaseURL = c.baseURL.String()
|
|
|
|
}
|
|
|
|
|
2022-03-21 22:27:35 +00:00
|
|
|
if c.Debug {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|