Documentation ¶
Index ¶
- Constants
- Variables
- func ErrorToErr(err error) error
- func Errorf(errKind ErrorKind, format string, a ...interface{}) error
- func FmtError(introMsg string, err error, jsonFlag bool) string
- func GetRootCAs(certsCAsDir string) (*x509.CertPool, error)
- func LoadX509KeyPair(certFile, keyFile string) (tls.Certificate, error)
- func LookupRegion() (string, error)
- func ParsePublicCertFile(certFile string) (x509Certs []*x509.Certificate, err error)
- type Err
- type ErrFn
- type Error
- type ErrorKind
Constants ¶
const ( EnvRegionName = "RADIO_REGION_NAME" EnvRegion = "RADIO_REGION" // legacy )
Top level common ENVs
const EnvCertPassword = "RADIO_CERT_PASSWD"
EnvCertPassword is the environment variable which contains the password used to decrypt the TLS private key. It must be set if the TLS private key is password protected.
const (
ValueSeparator = ","
)
Config value separator
Variables ¶
var ( ErrInvalidCacheDrivesValue = newErrFn( "Invalid cache drive value", "Please check the value in your config.yml", "Mounted drives or directories are wrong", ) ErrInvalidCacheExcludesValue = newErrFn( "Invalid cache excludes value", "Please check the passed value in your config.yml", "Cache exclusion patterns are incorrect please refer to documentation", ) ErrInvalidCacheExpiryValue = newErrFn( "Invalid cache expiry value", "Please check the passed value in your config.yml", "Valid cache expiry duration must be in days", ) ErrInvalidCacheQuota = newErrFn( "Invalid cache quota value", "Please check the passed value in your config.yml", " Valid cache quota value must be between 0-100", ) ErrInvalidCacheAfter = newErrFn( "Invalid cache after value", "Please check the passed value", "RADIO_CACHE_AFTER: Valid cache after value must be 0 or greater", ) ErrInvalidCacheWatermarkLow = newErrFn( "Invalid cache low watermark value", "Please check the passed value", "RADIO_CACHE_WATERMARK_LOW: Valid cache low watermark value must be between 0-100", ) ErrInvalidCacheWatermarkHigh = newErrFn( "Invalid cache high watermark value", "Please check the passed value", "RADIO_CACHE_WATERMARK_HIGH: Valid cache high watermark value must be between 0-100", ) ErrInvalidAddressFlag = newErrFn( "--address input is invalid", "Please check --address parameter", `--address binds to a specific ADDRESS:PORT, ADDRESS can be an IPv4/IPv6 address or hostname (default port is ':9000') Examples: --address ':443' --address '172.16.34.31:9000' --address '[fe80::da00:a6c8:e3ae:ddd7]:9000'`, ) ErrConfigInvalid = newErrFn( "--config input is invalid", "Please provide the correct path to your config", `--config or -c is path to your config.yml (default path is 'config.yml' in current directory) Examples: --config /etc/radio/config.yml --config config.yml --config /opt/radio/config.yml`, ) ErrPortAlreadyInUse = newErrFn( "Port is already in use", "Please ensure no other program uses the same address/port", "", ) ErrPortAccess = newErrFn( "Unable to use specified port", "Please ensure Radio binary has 'cap_net_bind_service=+ep' permissions", `Use 'sudo setcap cap_net_bind_service=+ep /path/to/radio' to provide sufficient permissions`, ) ErrSSLUnexpectedError = newErrFn( "Invalid TLS certificate", "Please check the content of your certificate data", `Only PEM (x.509) format is accepted as valid public & private certificates`, ) ErrSSLUnexpectedData = newErrFn( "Invalid TLS certificate", "Please check your certificate", "", ) ErrSSLNoPassword = newErrFn( "Missing TLS password", "Please set the password to environment variable `RADIO_CERT_PASSWD` so that the private key can be decrypted", "", ) ErrNoCertsAndHTTPSEndpoints = newErrFn( "HTTPS specified in endpoints, but no TLS certificate is found on the local machine", "Please add TLS certificate or use HTTP endpoints only", "Refer to https://docs.min.io/docs/how-to-secure-access-to-minio-server-with-tls for information about how to load a TLS certificate in your server", ) ErrCertsAndHTTPEndpoints = newErrFn( "HTTP specified in endpoints, but the server in the local machine is configured with a TLS certificate", "Please remove the certificate in the configuration directory or switch to HTTPS", "", ) ErrSSLWrongPassword = newErrFn( "Unable to decrypt the private key using the provided password", "Please set the correct password in environment variable `RADIO_CERT_PASSWD`", "", ) ErrInvalidRadioEndpoints = newErrFn( "Unable to initialize endpoint(s)", "Please check the specified value in your config.yml", "Please provide correct combination of remote servers", ) )
UI errors
Functions ¶
func ErrorToErr ¶
ErrorToErr inspects the passed error and transforms it to the appropriate UI error.
func Errorf ¶
Errorf - formats according to a format specifier and returns the string as a value that satisfies error of type config.Error
func GetRootCAs ¶
GetRootCAs - returns all the root CAs into certPool at the input certsCADir
func LoadX509KeyPair ¶
func LoadX509KeyPair(certFile, keyFile string) (tls.Certificate, error)
LoadX509KeyPair - load an X509 key pair (private key , certificate) from the provided paths. The private key may be encrypted and is decrypted using the ENV_VAR: RADIO_CERT_PASSWD.
func ParsePublicCertFile ¶
func ParsePublicCertFile(certFile string) (x509Certs []*x509.Certificate, err error)
ParsePublicCertFile - parses public cert into its *x509.Certificate equivalent.
Types ¶
type Err ¶
type Err struct {
// contains filtered or unexported fields
}
Err is a structure which contains all information to print a fatal error message in json or pretty mode Err implements error so we can use it anywhere