Documentation ¶
Overview ¶
Package configuration is in charge of the validation and extraction of all the configuration details from a configuration file.
Index ¶
- Constants
- type ConfigurationData
- func (c *ConfigurationData) GetCacheControlCollaborators() string
- func (c *ConfigurationData) GetCacheControlUser() string
- func (c *ConfigurationData) GetCacheControlUsers() string
- func (c *ConfigurationData) GetDefaultConfigurationFile() string
- func (c *ConfigurationData) GetHTTPAddress() string
- func (c *ConfigurationData) GetHeaderMaxLength() int64
- func (c *ConfigurationData) GetKeycloakAccountEndpoint(req *goa.RequestData) (string, error)
- func (c *ConfigurationData) GetKeycloakClientID() string
- func (c *ConfigurationData) GetKeycloakDevModeURL() string
- func (c *ConfigurationData) GetKeycloakDomainPrefix() string
- func (c *ConfigurationData) GetKeycloakEndpointAdmin(req *goa.RequestData) (string, error)
- func (c *ConfigurationData) GetKeycloakEndpointAuth(req *goa.RequestData) (string, error)
- func (c *ConfigurationData) GetKeycloakEndpointAuthzResourceset(req *goa.RequestData) (string, error)
- func (c *ConfigurationData) GetKeycloakEndpointBroker(req *goa.RequestData) (string, error)
- func (c *ConfigurationData) GetKeycloakEndpointClients(req *goa.RequestData) (string, error)
- func (c *ConfigurationData) GetKeycloakEndpointEntitlement(req *goa.RequestData) (string, error)
- func (c *ConfigurationData) GetKeycloakEndpointLogout(req *goa.RequestData) (string, error)
- func (c *ConfigurationData) GetKeycloakEndpointToken(req *goa.RequestData) (string, error)
- func (c *ConfigurationData) GetKeycloakEndpointUserInfo(req *goa.RequestData) (string, error)
- func (c *ConfigurationData) GetKeycloakRealm() string
- func (c *ConfigurationData) GetKeycloakSecret() string
- func (c *ConfigurationData) GetKeycloakTestUser2Name() string
- func (c *ConfigurationData) GetKeycloakTestUser2Secret() string
- func (c *ConfigurationData) GetKeycloakTestUserName() string
- func (c *ConfigurationData) GetKeycloakTestUserSecret() string
- func (c *ConfigurationData) GetLogLevel() string
- func (c *ConfigurationData) GetNotApprovedRedirect() string
- func (c *ConfigurationData) GetOpenshiftTenantMasterURL() string
- func (c *ConfigurationData) GetPostgresConfigString() string
- func (c *ConfigurationData) GetPostgresConnectionMaxIdle() int
- func (c *ConfigurationData) GetPostgresConnectionMaxOpen() int
- func (c *ConfigurationData) GetPostgresConnectionRetrySleep() time.Duration
- func (c *ConfigurationData) GetPostgresConnectionTimeout() int64
- func (c *ConfigurationData) GetPostgresDatabase() string
- func (c *ConfigurationData) GetPostgresHost() string
- func (c *ConfigurationData) GetPostgresPassword() string
- func (c *ConfigurationData) GetPostgresPort() int64
- func (c *ConfigurationData) GetPostgresSSLMode() string
- func (c *ConfigurationData) GetPostgresTransactionTimeout() time.Duration
- func (c *ConfigurationData) GetPostgresUser() string
- func (c *ConfigurationData) GetTenantServiceURL() string
- func (c *ConfigurationData) GetTokenPrivateKey() []byte
- func (c *ConfigurationData) GetTokenPublicKey() []byte
- func (c *ConfigurationData) GetValidRedirectURLs(req *goa.RequestData) (string, error)
- func (c *ConfigurationData) IsLogJSON() bool
- func (c *ConfigurationData) IsPostgresDeveloperModeEnabled() bool
- func (c *ConfigurationData) String() string
Constants ¶
const ( // DefaultValidRedirectURLs is a regex to be used to whitelist redirect URL for auth // If the AUTH_REDIRECT_VALID env var is not set then in Dev Mode all redirects allowed - * // In prod mode the following regex will be used by default: DefaultValidRedirectURLs = "^(https|http)://([^/]+[.])?(?i:openshift[.]io)(/.*)?$" // *.openshift.io/* )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConfigurationData ¶
type ConfigurationData struct {
// contains filtered or unexported fields
}
ConfigurationData encapsulates the Viper configuration object which stores the configuration data in-memory.
func GetConfigurationData ¶
func GetConfigurationData() (*ConfigurationData, error)
GetConfigurationData is a wrapper over NewConfigurationData which reads configuration file path from the environment variable.
func NewConfigurationData ¶
func NewConfigurationData(configFilePath string) (*ConfigurationData, error)
NewConfigurationData creates a configuration reader object using a configurable configuration file path
func (*ConfigurationData) GetCacheControlCollaborators ¶
func (c *ConfigurationData) GetCacheControlCollaborators() string
GetCacheControlCollaborators returns the value to set in the "Cache-Control" HTTP response header when returning collaborators.
func (*ConfigurationData) GetCacheControlUser ¶
func (c *ConfigurationData) GetCacheControlUser() string
GetCacheControlUser returns the value to set in the "Cache-Control" HTTP response header when data for the current user.
func (*ConfigurationData) GetCacheControlUsers ¶
func (c *ConfigurationData) GetCacheControlUsers() string
GetCacheControlUsers returns the value to set in the "Cache-Control" HTTP response header when returning users.
func (*ConfigurationData) GetDefaultConfigurationFile ¶
func (c *ConfigurationData) GetDefaultConfigurationFile() string
GetDefaultConfigurationFile returns the default configuration file.
func (*ConfigurationData) GetHTTPAddress ¶
func (c *ConfigurationData) GetHTTPAddress() string
GetHTTPAddress returns the HTTP address (as set via default, config file, or environment variable) that the alm server binds to (e.g. "0.0.0.0:8089")
func (*ConfigurationData) GetHeaderMaxLength ¶
func (c *ConfigurationData) GetHeaderMaxLength() int64
GetHeaderMaxLength returns the max length of HTTP headers allowed in the system For example it can be used to limit the size of bearer tokens returned by the api service
func (*ConfigurationData) GetKeycloakAccountEndpoint ¶
func (c *ConfigurationData) GetKeycloakAccountEndpoint(req *goa.RequestData) (string, error)
GetKeycloakAccountEndpoint returns the API URL for Read and Update on Keycloak User Accounts.
func (*ConfigurationData) GetKeycloakClientID ¶
func (c *ConfigurationData) GetKeycloakClientID() string
GetKeycloakClientID returns the keycloak client ID (as set via config file or environment variable) that is used to make authorized Keycloak API Calls.
func (*ConfigurationData) GetKeycloakDevModeURL ¶
func (c *ConfigurationData) GetKeycloakDevModeURL() string
GetKeycloakDevModeURL returns Keycloak URL used by default in Dev mode
func (*ConfigurationData) GetKeycloakDomainPrefix ¶
func (c *ConfigurationData) GetKeycloakDomainPrefix() string
GetKeycloakDomainPrefix returns the domain prefix which should be used in all Keycloak requests
func (*ConfigurationData) GetKeycloakEndpointAdmin ¶
func (c *ConfigurationData) GetKeycloakEndpointAdmin(req *goa.RequestData) (string, error)
GetKeycloakEndpointAdmin returns the <keycloak>/realms/admin/<realm> endpoint set via config file or environment variable. If nothing set then in Dev environment the defualt endopoint will be returned. In producion the endpoint will be calculated from the request by replacing the last domain/host name in the full host name. Example: api.service.domain.org -> sso.service.domain.org or api.domain.org -> sso.domain.org
func (*ConfigurationData) GetKeycloakEndpointAuth ¶
func (c *ConfigurationData) GetKeycloakEndpointAuth(req *goa.RequestData) (string, error)
GetKeycloakEndpointAuth returns the keycloak auth endpoint set via config file or environment variable. If nothing set then in Dev environment the defualt endopoint will be returned. In producion the endpoint will be calculated from the request by replacing the last domain/host name in the full host name. Example: api.service.domain.org -> sso.service.domain.org or api.domain.org -> sso.domain.org
func (*ConfigurationData) GetKeycloakEndpointAuthzResourceset ¶
func (c *ConfigurationData) GetKeycloakEndpointAuthzResourceset(req *goa.RequestData) (string, error)
GetKeycloakEndpointAuthzResourceset returns the <keycloak>/realms/<realm>/authz/protection/resource_set endpoint set via config file or environment variable. If nothing set then in Dev environment the defualt endopoint will be returned. In producion the endpoint will be calculated from the request by replacing the last domain/host name in the full host name. Example: api.service.domain.org -> sso.service.domain.org or api.domain.org -> sso.domain.org
func (*ConfigurationData) GetKeycloakEndpointBroker ¶
func (c *ConfigurationData) GetKeycloakEndpointBroker(req *goa.RequestData) (string, error)
GetKeycloakEndpointBroker returns the <keycloak>/realms/<realm>/authz/entitlement/<clientID> endpoint set via config file or environment variable. If nothing set then in Dev environment the defualt endopoint will be returned. In producion the endpoint will be calculated from the request by replacing the last domain/host name in the full host name. Example: api.service.domain.org -> sso.service.domain.org or api.domain.org -> sso.domain.org
func (*ConfigurationData) GetKeycloakEndpointClients ¶
func (c *ConfigurationData) GetKeycloakEndpointClients(req *goa.RequestData) (string, error)
GetKeycloakEndpointClients returns the <keycloak>/admin/realms/<realm>/clients endpoint set via config file or environment variable. If nothing set then in Dev environment the defualt endopoint will be returned. In producion the endpoint will be calculated from the request by replacing the last domain/host name in the full host name. Example: api.service.domain.org -> sso.service.domain.org or api.domain.org -> sso.domain.org
func (*ConfigurationData) GetKeycloakEndpointEntitlement ¶
func (c *ConfigurationData) GetKeycloakEndpointEntitlement(req *goa.RequestData) (string, error)
GetKeycloakEndpointEntitlement returns the <keycloak>/realms/<realm>/authz/entitlement/<clientID> endpoint set via config file or environment variable. If nothing set then in Dev environment the defualt endopoint will be returned. In producion the endpoint will be calculated from the request by replacing the last domain/host name in the full host name. Example: api.service.domain.org -> sso.service.domain.org or api.domain.org -> sso.domain.org
func (*ConfigurationData) GetKeycloakEndpointLogout ¶
func (c *ConfigurationData) GetKeycloakEndpointLogout(req *goa.RequestData) (string, error)
GetKeycloakEndpointLogout returns the keycloak logout endpoint set via config file or environment variable. If nothing set then in Dev environment the defualt endopoint will be returned. In producion the endpoint will be calculated from the request by replacing the last domain/host name in the full host name. Example: api.service.domain.org -> sso.service.domain.org or api.domain.org -> sso.domain.org
func (*ConfigurationData) GetKeycloakEndpointToken ¶
func (c *ConfigurationData) GetKeycloakEndpointToken(req *goa.RequestData) (string, error)
GetKeycloakEndpointToken returns the keycloak token endpoint set via config file or environment variable. If nothing set then in Dev environment the defualt endopoint will be returned. In producion the endpoint will be calculated from the request by replacing the last domain/host name in the full host name. Example: api.service.domain.org -> sso.service.domain.org or api.domain.org -> sso.domain.org
func (*ConfigurationData) GetKeycloakEndpointUserInfo ¶
func (c *ConfigurationData) GetKeycloakEndpointUserInfo(req *goa.RequestData) (string, error)
GetKeycloakEndpointUserInfo returns the keycloak userinfo endpoint set via config file or environment variable. If nothing set then in Dev environment the defualt endopoint will be returned. In producion the endpoint will be calculated from the request by replacing the last domain/host name in the full host name. Example: api.service.domain.org -> sso.service.domain.org or api.domain.org -> sso.domain.org
func (*ConfigurationData) GetKeycloakRealm ¶
func (c *ConfigurationData) GetKeycloakRealm() string
GetKeycloakRealm returns the keycloak realm name
func (*ConfigurationData) GetKeycloakSecret ¶
func (c *ConfigurationData) GetKeycloakSecret() string
GetKeycloakSecret returns the keycloak client secret (as set via config file or environment variable) that is used to make authorized Keycloak API Calls.
func (*ConfigurationData) GetKeycloakTestUser2Name ¶
func (c *ConfigurationData) GetKeycloakTestUser2Name() string
GetKeycloakTestUser2Name returns the keycloak test user name used to obtain a test token (as set via config file or environment variable)
func (*ConfigurationData) GetKeycloakTestUser2Secret ¶
func (c *ConfigurationData) GetKeycloakTestUser2Secret() string
GetKeycloakTestUser2Secret returns the keycloak test user password used to obtain a test token (as set via config file or environment variable)
func (*ConfigurationData) GetKeycloakTestUserName ¶
func (c *ConfigurationData) GetKeycloakTestUserName() string
GetKeycloakTestUserName returns the keycloak test user name used to obtain a test token (as set via config file or environment variable)
func (*ConfigurationData) GetKeycloakTestUserSecret ¶
func (c *ConfigurationData) GetKeycloakTestUserSecret() string
GetKeycloakTestUserSecret returns the keycloak test user password used to obtain a test token (as set via config file or environment variable)
func (*ConfigurationData) GetLogLevel ¶
func (c *ConfigurationData) GetLogLevel() string
GetLogLevel returns the loggging level (as set via config file or environment variable)
func (*ConfigurationData) GetNotApprovedRedirect ¶
func (c *ConfigurationData) GetNotApprovedRedirect() string
GetNotApprovedRedirect returns the URL to redirect to if the user is not approved May return empty string which means an unauthorized error should be returned instead of redirecting the user
func (*ConfigurationData) GetOpenshiftTenantMasterURL ¶
func (c *ConfigurationData) GetOpenshiftTenantMasterURL() string
GetOpenshiftTenantMasterURL returns the URL for the openshift cluster where the tenant services are running
func (*ConfigurationData) GetPostgresConfigString ¶
func (c *ConfigurationData) GetPostgresConfigString() string
GetPostgresConfigString returns a ready to use string for usage in sql.Open()
func (*ConfigurationData) GetPostgresConnectionMaxIdle ¶
func (c *ConfigurationData) GetPostgresConnectionMaxIdle() int
GetPostgresConnectionMaxIdle returns the number of connections that should be keept alive in the database connection pool at any given time. -1 represents no restrictions/default behavior
func (*ConfigurationData) GetPostgresConnectionMaxOpen ¶
func (c *ConfigurationData) GetPostgresConnectionMaxOpen() int
GetPostgresConnectionMaxOpen returns the max number of open connections that should be open in the database connection pool. -1 represents no restrictions/default behavior
func (*ConfigurationData) GetPostgresConnectionRetrySleep ¶
func (c *ConfigurationData) GetPostgresConnectionRetrySleep() time.Duration
GetPostgresConnectionRetrySleep returns the number of seconds (as set via default, config file, or environment variable) to wait before trying to connect again
func (*ConfigurationData) GetPostgresConnectionTimeout ¶
func (c *ConfigurationData) GetPostgresConnectionTimeout() int64
GetPostgresConnectionTimeout returns the postgres connection timeout as set via default, config file, or environment variable
func (*ConfigurationData) GetPostgresDatabase ¶
func (c *ConfigurationData) GetPostgresDatabase() string
GetPostgresDatabase returns the postgres database as set via default, config file, or environment variable
func (*ConfigurationData) GetPostgresHost ¶
func (c *ConfigurationData) GetPostgresHost() string
GetPostgresHost returns the postgres host as set via default, config file, or environment variable
func (*ConfigurationData) GetPostgresPassword ¶
func (c *ConfigurationData) GetPostgresPassword() string
GetPostgresPassword returns the postgres password as set via default, config file, or environment variable
func (*ConfigurationData) GetPostgresPort ¶
func (c *ConfigurationData) GetPostgresPort() int64
GetPostgresPort returns the postgres port as set via default, config file, or environment variable
func (*ConfigurationData) GetPostgresSSLMode ¶
func (c *ConfigurationData) GetPostgresSSLMode() string
GetPostgresSSLMode returns the postgres sslmode as set via default, config file, or environment variable
func (*ConfigurationData) GetPostgresTransactionTimeout ¶
func (c *ConfigurationData) GetPostgresTransactionTimeout() time.Duration
GetPostgresTransactionTimeout returns the number of minutes to timeout a transaction
func (*ConfigurationData) GetPostgresUser ¶
func (c *ConfigurationData) GetPostgresUser() string
GetPostgresUser returns the postgres user as set via default, config file, or environment variable
func (*ConfigurationData) GetTenantServiceURL ¶
func (c *ConfigurationData) GetTenantServiceURL() string
GetTenantServiceURL returns the URL for the Tenant service used by login to initialize OSO tenant space
func (*ConfigurationData) GetTokenPrivateKey ¶
func (c *ConfigurationData) GetTokenPrivateKey() []byte
GetTokenPrivateKey returns the private key (as set via config file or environment variable) that is used to sign the authentication token.
func (*ConfigurationData) GetTokenPublicKey ¶
func (c *ConfigurationData) GetTokenPublicKey() []byte
GetTokenPublicKey returns the public key (as set via config file or environment variable) that is used to decrypt the authentication token.
func (*ConfigurationData) GetValidRedirectURLs ¶
func (c *ConfigurationData) GetValidRedirectURLs(req *goa.RequestData) (string, error)
GetValidRedirectURLs returns the RegEx of valid redirect URLs for auth requests If the AUTH_REDIRECT_VALID env var is not set then in Dev Mode all redirects allowed - * In prod mode the default regex will be returned
func (*ConfigurationData) IsLogJSON ¶
func (c *ConfigurationData) IsLogJSON() bool
IsLogJSON returns if we should log json format (as set via config file or environment variable)
func (*ConfigurationData) IsPostgresDeveloperModeEnabled ¶
func (c *ConfigurationData) IsPostgresDeveloperModeEnabled() bool
IsPostgresDeveloperModeEnabled returns if development related features (as set via default, config file, or environment variable), e.g. token generation endpoint are enabled
func (*ConfigurationData) String ¶
func (c *ConfigurationData) String() string
String returns the current configuration as a string